c++ - Is p = array the same as p = &array[0]? -


int numbers[20]; int * p;     

are 2 assignments below same?

p = numbers; p = &numbers[0]; 

yes both same.

in case, name of array decays pointer first element.

hence,

p = numbers;       //name of array 

is same as:

p = &numbers[0];   //address of first element of array 

Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -