Pointer to an Array

An array name is a constant pointer to the first element of the array.

 

(constant pointer cannot change the location it points at)

 

int *myPointer ;

int myArray[42] ;

 

myPointer = myArray ;

 

myArray is a pointer to &myArray[0] which is the first element of myArray

 

Note: line 13 gives a brief intro to pointer arithmetic...

Leave a Reply