< Previous | Contents | Next >

Understanding the Relationship between Pointers and Arrays

Pointers have an intimate relationship with arrays. In fact, an array name is really a constant pointer to the first element of the array. Because the elements of an array are stored in a contiguous block of memory, you can use the array name as a pointer for random access to elements. This relationship also has important implications for how you can pass and return arrays, as youll soon see.


 

Introducing the Array Passer ProgramUsing an Array Name as a Constant PointerPassing and Returning Arrays