Re:To become a good C programmer (2011)
by bluetomcat on Sunday May 01, 2016 @03:17PM
(#11607477)
> and when it is the operand of "&"
Another slightly confusing aspect is that `&array` gives you a "pointer to array" (which has the same value as `&array[0]`, but is of a different type). Most importantly, it behaves differently in pointer arithmetic (the implied offset is the size of the array, rather than the size of its elements).
Fabien is hinting at the confusion: sizeof(&array[0]) != sizeof(array)
&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.
So your reasoning is not quite correct, it should really be that you think of
as being where "something" could be of any type T, and so the '&' operator yields "pointer-to-T", to which sizeof will yield the size of a pointer.