Overview

Pointers have the same size as the machine’s word size since it should be able to refer to any virtual address. All pointers are either valid, null, or indeterminate.

C allows arithmetic on pointers, where the computed value is scaled according to the size of the data type referenced by the pointer.

NULL

The NULL macro refers to a null pointer constant, an ICE with value 0 or such an expression cast to type void*. The following table lists some valid values NULL can take on:

ExpansionType
0Uunsigned
0signed
\0signed
Enum constant of value 0signed
0ULunsigned long
0Lsigned long
0ULLunsigned long long
0LLsigned long long
(void*)0void*

Aliasing

Accessing the same object through different pointers is called aliasing. With the exclusion of character types, only pointers of the same base type may alias.

Bibliography

  • Jens Gustedt, Modern C (Shelter Island, NY: Manning Publications Co, 2020).