Are all data pointers the same size in one platform for all data types? [duplicate]

They’re not guaranteed to be the same size, although on the platforms I have experience with they usually are.

C 2011 online draft:

6.2.5 Types

28     A pointer to void shall have the same representation and alignment requirements as a
pointer to a character type.48) Similarly, pointers to qualified or unqualified versions of
compatible types shall have the same representation and alignment requirements. All
pointers to structure types shall have the same representation and alignment requirements
as each other. All pointers to union types shall have the same representation and
alignment requirements as each other. Pointers to other types need not have the same
representation or alignment requirements.


48) The same representation and alignment requirements are meant to imply interchangeability as
arguments to functions, return values from functions, and members of unions.

Leave a Comment