3 dimensional array in c code example
Example 1: get elements of 2d array c++
void printMatrix(array, ROWS> matrix){
for (auto row : matrix){
//auto infers that row is of type array
for (auto element : row){
cout << element << ' ';
}
cout << endl;
}
Example 2: declaring 3d arrays
int test[2][3][4] = {
{{3, 4, 2, 3}, {0, -3, 9, 11}, {23, 12, 23, 2}},
{{13, 4, 56, 3}, {5, 9, 3, 5}, {3, 1, 4, 9}}}