C pointers and arrays/ ‘sizeof’ operator [duplicate]

Yes, your assumption is correct, assuming an int and a pointer are both 4 bytes long on your machine.

And no, arrays aren’t pointers. The array name sometimes decays into a pointer in certain contexts, but they aren’t the same thing. There is a whole section of the comp.lang.c FAQ dedicated to this common point of confusion.

Leave a Comment