1//[2] is elements; [3] is rows in elements; [4] is column in elemnents
2int a[2][3][2]= {
3 //Element 0
4 { {1, 2},
5 {2, 3},
6 {4, 5}
7
8 },
9
10
11 // Element 1
12 { {6, 7},
13 {8, 9},
14 {10, 11}
15
16 }
17 };
18
19 cout << a[0][1][1]; // Prints 3
1#include <array>
22 #include <iostream>
33
44 using namespace std;
55
66 //remember const!
77 const int ROWS = 2;
88 const int COLS = 3;
99
1010 void printMatrix(array<array<int, COLS>, ROWS> matrix){
1111 //for each row
1212 for (int row = 0; row < matrix.size(); ++row){
1313 //for each element in the current row
1414 for (int col = 0; col < matrix[row].size(); ++col){
1515 cout << matrix[row][col] << ' ';
1616 }
1717 cout << endl;
1818 }
1919 }
1void printMatrix(array<array<int, COLS>, ROWS> matrix){
2for (auto row : matrix){
3//auto infers that row is of type array<int, COLS>
4for (auto element : row){
5cout << element << ' ';
6}
7cout << endl;
8}