The sizeof operator must behave differently, for example, if you change the declaration of a to a different number of integers, for example int a[7] :
int main() { int a[7]; auto b = a; auto c = &a; std::cout << sizeof(*b) << std::endl;
For me, this prints:
4 28
This is because the two pointers are very different. One is a pointer to an integer, and the other is a pointer to an array of 7 integers.
The second really has a pointer-array type. If you cast it, of course, it will break into a pointer in most cases, but in fact it is not a pointer to a pointer to an int. The first is an int-pointer because the decay occurred on assignment.
Other places that will be displayed are if you really have two pointer-array variables, and tried to assign them to others:
int main() { int a[7]; int b[9]; auto aa = &a; auto bb = &b; aa = bb; return 0; }
This brings me an error message:
xx.cpp: In function 'int main()': xx.cpp:14:8: error: cannot convert 'int (*)[9]' to 'int (*)[7]' in assignment aa = bb;
This example, however, works because dereferencing bb allows it to decay into pointer-to-int:
int main() { int a; int b[9]; auto aa = &a; auto bb = &b; aa = *bb; return 0; }
Note that decay does not occur on the left side of the assignment. This does not work:
int main() { int a[7]; int b[9]; auto aa = &a; auto bb = &b; *aa = *bb; return 0; }
This will work:
xx2.cpp: In function 'int main()': xx2.cpp:14:9: error: incompatible types in assignment of 'int [9]' to 'int [7]' *aa = *bb;