The following excerpt is from Harbinson, Steele C: A Reference Manual (5th Edition). According to the book the two assignments to p
are equivalent.
7.5.6 Address Operator
int a[10], *p;
p = a; p = *&a;
Yet, according to the C faq Question 6.12 a
is of type pointer to int
whereas &a
is of type pointer to array of int
.
So we should get a type error in the second assignment p = *&a
because we are trying to assign an array of int
to a pointer.
Why is the assignment p = *&a
correct?