Given an array declaration T a[N]
, the expression &a
has type "pointer to N-element array of T
(T (*)[N]
) and its value is the base address of the array. In that respect, the unary &
operator behaves the same for arrays as it does for any other data type.
What's hinky is how C treats the array expression a
. Except when it is the operand of the sizeof
or unary &
operators, or is a string literal being used to initialize another array in a declaration, an array expression of type "N-element array of T
" (T [N]
) will be replaced with ("decay to") a pointer expression of type "pointer to T
" (T *
) and its value will be the address of the first element of the array. IOW, a == &a[0]
.
Since the address of the first element of the array is the same as the base address of the entire array, the expressions a
and &a
yield the same value, but the types are different (T *
as opposed to T (*)[N]
).