Assigned Reading:
Handouts (available on-line): Project 3
Topics Covered:
The next question is: suppose ptr1 is a pointer to an array (as in the example above), then what does ptr1[i] mean? The answer is that this is only meaningful if you have an array of arrays. In the next example, SuperArray is an array of int_array's. Each int_array is an array of 17 integers. Now, if we assign the address of the first element of SuperArray to ArrayPtr, then ArrayPtr[2] refers to the third element of SuperArray, which is itself an array. In fact, we can continue on and use the notation ArrayPtr[2][13] to refer to the 14th integer element of the array that is the third element of SuperArray. So, in fact SuperArray is exactly a two dimensional array. (See sample run.)