initate an array in cpp code example Example 1: c++ initialize array int arr[3] = {1, 5, 4}; Example 2: initialize array c++ int foo [5];