Joel Joel - 1 year ago 91
C Question

Is the sizeof(some pointer) always equal to four?

For example:

returns 4. As does
long long*
, everything that I've tried. Are there any exceptions to this?

Answer Source

The guarantee you get is that sizeof(char) == 1. There are no other guarantees, including no guarantee that sizeof(int *) == sizeof(double *).

In practice, pointers will be size 2 on a 16-bit system (if you can find one), 4 on a 32-bit system, and 8 on a 64-bit system, but there's nothing to be gained in relying on a given size.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download