[dcl.array] (original) (raw)
:
int x3d[3][5][7];
declares an array of three elements, each of which is an array of five elements, each of which is an array of seven integers.
The overall array can be viewed as a three-dimensional array of integers, with rank .
Any of the expressionsx3d,x3d[i],x3d[i][j],x3d[i][j][k]can reasonably appear in an expression.
The expressionx3d[i]is equivalent to*(x3d + i); in that expression,x3dis subject to the array-to-pointer conversion ([conv.array]) and is first converted to a pointer to a 2-dimensional array with rankthat points to the first element of x3d.
Then i is added, which on typical implementations involves multiplyingi by the length of the object to which the pointer points, which is sizeof(int).
The result of the addition and indirection is an lvalue denoting the array element ofx3d(an array of five arrays of seven integers).
If there is another subscript, the same argument applies again, sox3d[i][j] is an lvalue denoting the array element of the array element ofx3d(an array of seven integers), andx3d[i][j][k] is an lvalue denoting the array element of the array element of the array element ofx3d(an integer).
— end example