C++ Code Example 2: multidimensional array

Code example to output the elements of a multidimensional array, using 2 nested for-loops

#include <iostream>
using namespace std;

int main() {
    int myArray[2][5] = {{0, 1, 2, 3, 4}, {5, 6, 7, 8, 9}};

    for (int i = 0; i < 2; i++) {
        for (int j = 0; j < 5; j++) {
            cout << myArray[i][j];
        }
        cout << endl;
    }

    return 0;
}
Output
01234
56789