initialized array to a number c++ code example Example 1: c++ initialise array int nCount[] = {1, 2, 3, 4, 5}; Example 2: initialize array c++ int foo [5];