how to access array elements in c++ using for loop code example
Example 1: loop through array c++
for(int i = 0; i < 4; i++) {
cout << cars[i] << "\n";
}
Example 2: for loop with array c++
int v[] = {1,2,3,4,5};
for (int n : v)
cout << n << endl;
//make sure to compile with -std=c++11