I am trying to create an array of two 2D arrays as follows
Given
char twoDArr[2][3] = {{'a','b','c'}, {'d','e','f'}};
you could do
char (*twoDArrP)[3] = twoDArr;
which yields valid results in:
cout << "twoDArr: " << twoDArr[1][2] << endl;
cout << "twoDArrP: " << twoDArrP[1][2] << endl;
My goal is to create another (static) array and/or pointer as follows
char (**threeDArr)[3] = {twoDArr, twoDArr}; //doesn't compile
so that I can be able to access its values as:
char val = threeDArr[0][1][2];
Obviously the indices will vary
The question is what is the correct way of declaring the 3D array, i.e. the array of 2D arrays ??
I have searched for an example using this case and I cannot seem to find anything. Any help would be appreciated.