:
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
3×5×7. Any of the expressions
x3d,
x3d[i],
x3d[i][j],
x3d[i][j][k]
can reasonably appear in an expression
. The expression
x3d[i]
is equivalent to
*(x3d + i);
in that expression,
x3d
is subject to the array-to-pointer conversion (
[conv.array])
and is first converted to
a pointer to a 2-dimensional
array with rank
5×7
that points to the first element of
x3d. Then
i is added,
which on typical implementations involves multiplying
i by the
length of the object to which the pointer points,
which is
sizeof(int)×5×7. The result of the addition and indirection is
an lvalue denoting
the
ith array element of
x3d
(an array of five arrays of seven integers)
. If there is another subscript,
the same argument applies again, so
x3d[i][j] is
an lvalue denoting
the
jth array element of
the
ith array element of
x3d
(an array of seven integers), and
x3d[i][j][k] is
an lvalue denoting
the
kth array element of
the
jth array element of
the
ith array element of
x3d
(an integer)
. —
end example