c++ - When do I use & when making a pointer -


this question has answer here:

i understand this:

    int foo = 5;     int * foopointer = &foo; 

but know can this:

    int foo[5] = {32,12,4};     int * fooptr = food; 

which strange because when int have put & operator before foo, don't have if array. can declare pointer , array?

it's not list; it's array.

under circumstances, name of array evaluates address of first element of array, can assign (or use initialize) pointer element type of array.

there few exceptions (passing array sizeof or address-of operator (unary &), or passing array reference, none of applies here.


Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

gradle error "Cannot convert the provided notation to a File or URI" -

python - NameError: name 'subprocess' is not defined -