the fact that a
can never point to any other location
This isn't a fact, though. If a
is an array, a
doesn't point anywhere because a
is not a pointer. Given int a[42];
, a
names an array of 42 int
objects; it is not a pointer to an array of 42 int
objects (that would be int (*a)[42];
).
&x
gives you the address of the object x
; if x
is an array type variable, then &x
gives you the address of the array; if nothing else, this is consistent with the behavior of &
for any other object.
A better question would be "why does an array (like a
) decay to a pointer to its initial element in most cases when it is used?" While I don't know with certainty why the language was designed this way, it does make the specification of many things much simpler, notably, arithmetic with an array is effectively the same as arithmetic with a pointer.