Pointers
A pointer …
- is a special type of variable
- storing the address (memory location) of another variable
A pointer occupies space in memory, just like any other variable of a certain type
The number of memory cells needed for a pointer depends on the computer's architecture:
- Old computer, or hand-held device with only 64KB of addressable memory:
- 2 memory cells (i.e. 16 bits) to hold any address from
0x0000 to 0xFFFF (= 65535)
- Desktop machine with 4GB of addressable memory
- 4 memory cells (i.e. 32 bits) to hold any address from
0x00000000 to 0xFFFFFFFF (= 4294967295)
- Modern 64-bit computer
- 8 memory cells (can address 264 bytes, but in practice the amount of memory is limited by the CPU)
|