I believe there is no requirement that pointers are all the same size. The only requirement is that all object pointers can be stored in void *
, that when cast to void *
and back they'll be the same, and that all function pointers, if cast to another type of function pointer and back again, will be the same. (Casting function pointers to void *
is not guaranteed to work. Sorry if I indicated otherwise.)
In practice, I think the only time you'll find pointers of different sizes is if you care about C++'s member-function pointers, or you work on a more obscure architecture.
In C90, char arr[];
is a valid way to pre-declare a global array of to-be-determined length. Note that char arr[]
is an incomplete type, so you have to declare it before you can use sizeof
. It's not valid the way it is in C99, to make flexible array members.