This is the first time I have seen sizeof used like this: sizeof( &array[0] ) This looks equal to: sizeof( array ) at first glance, which would give the size of the entire array in bytes, but of course the &array[0] expression is really: &*( array + 0 ) which simplifies to: array + 0 which is a pointer. And using sizeof on it gives the size of a pointer to int. Edit: (&* array) will also give a pointer. --- This is j…
The array->pointer "decay" (as the standard calls it) has 3 exceptions, of which two are when an array is the operand of "sizeof", and when it is the operand of "&". (The third involves a string initialiser, which is not relevant here.) So your reasoning is not quite correct, it should really be that you think of sizeof( &array[0] ) as being sizeof( &(something) ) where "something" could be of any type T, and so the…
&array[0] and array decay to the same thing, the pointer to the first element if they are used in an expression. But sizeof gives a different result, because array+0 'decays' to a pointer, and array doesn't.