the pointer existential crisis dielma: If pointer stores memory address then how are memory addresses of a pointers stored?

9 hours ago 2
ARTICLE AD BOX

You know that computers have memory.

Memory cells are numbered for identification, we call these numbers "addresses".

Variables exist in memory, and so they have implicitly an address. The program can know this address.

A pointer is "just" an specific type of variable. You store the address of another variable in it. This pointer exists in memory and has as address, too. But there is no necessity to have another variable to hold this address.

pointer diagram

The diagram above shows the memory as a vertical ordered set of cells.

This principle is independent of the abstract definitions of memory ranges, like "heap", "stack", "static allocations", "dynamic allocation", "global", "local", and so on.

Remarkable exceptions are processor registers. These can store values, too, including addresses. But you cannot have an address of any of them, as they are not allocated in memory.

Read Entire Article