Pointers and Multidimensional Arrays
How do pointers relate to multidimensional arrays? Let's look at some examples now to find the answer. To simplify the discussion, you'll examine an array that is much smaller than rain. Suppose you have this declaration:
int zippo[4][2]; /* an array of arrays of ints */
Then zippo, being the name of an array, is the address of the first element of the array. In this case, the first element of zippo is itself an array of two ints, so zippo is the address of an array of two ints. Let's analyze that further in terms of pointer properties:
Because zippo is the address of the array's first element, zippo equals &zippo[0]. Next, zippo[0] is itself an array of two integers, so zippo[0] equals &zippo[0][0], the ...
Get C Primer Plus®, Third Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.