An array is not a pointer. It evaluates a pointer in almost all contexts, but one of the notable exceptions is the & operator.
So, if you call a function with an array as a parameter
f(a);
the a evaluates the address of the first element &(a[0]) , which is passed to the function.
If you use &a , the address of the array as a whole is taken. It has the same meaning as &(a[0]) , but the type is different. &(a[0]) is of type "pointer to base type", while &a is of type "pointer to array of base type".
Inside the &a function is something else. Here a is a "pointer to basetype", therefore &a is of type "pointer to a pointer to a base type", and the address you see is the address of the pointer on the stack, not your original array.
Jens gustedt
source share