sizeof cannot give you the size of dynamically allocated memory. It ends up telling you the size of the pointer you use.

A static array's size on the other hand is known at compile time, so sizeof does give the expected value.