August 2012
Intermediate to advanced
976 pages
30h 17m
English
As with any array, we can use a subscript to access the elements of a multidimensional array. To do so, we use a separate subscript for each dimension.
If an expression provides as many subscripts as there are dimensions, we get an element with the specified type. If we supply fewer subscripts than there are dimensions, then the result is the inner-array element at the specified index:
// assigns the first element of arr to the last element in the last row of iaia[2][3] = arr[0][0][0];int (&row)[4] = ia[1]; // binds row to the second four-element array in ia
In the first example we supply indices for all the dimensions for both arrays. On the left-hand side, ia[2] returns the last row in ia. It does not fetch ...
Read now
Unlock full access