That's nice, Dark_samurai is right though. The sizeof operator in the second example should result in 40.

The wording in the standard is crap, but it clearly says that array sizes are returned. The relevant quote:

Quote:

When applied to an operand that has array type, the result is the total number of bytes in the array.

(Section 6.5.3.4)

Pointers on the other hand don't count as arrays as far as the standard is concerned, so if it were a pointer, it should return 4.


Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com