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

c# - ItextSharp font color issue in ver 5.5.4+ -

jquery - Multiple issues with pushstate: history, loading, calling functions -

ios - retrievePeripherals deprecated in IOS7 how to substitude it with retrievePeripheralsWithIdentifiers -