If a variable x is stored at memory address 2000, and a pointer p contains the value 2000, where is p itself stored? Does the computer need another pointer to locate p, creating an endless chain of addresses? For example, would p be stored at address 1000, and would something else need to point to address 1000?
4 Answers
A pointer is just another variable whose value happens to represent a memory address. The language implementation chooses a location for it, just as it chooses a location for x. If p is stored at address 1000, the bytes at 1000 contain the number 2000. The chain does not continue forever because the program accesses p through a known location, such as a stack-frame offset, a global address, or a CPU register.
Local variables are commonly stored in a function's stack frame. The compiler can refer to them using an offset from a stack or frame pointer, such as FP + 8. So it does not need another pointer variable just to find p; the generated machine instructions already know how to calculate p's location. If you explicitly want another level, you can create a pointer to a pointer, but that is optional.
The exact storage location depends on the variable: globals may be placed in a data section, local variables usually use the stack, and dynamically allocated objects use the heap. The compiler or runtime keeps track of these locations. Also, modern systems often randomize actual addresses, so programs generally use symbolic or relative addressing instead of relying on fixed numbers like 1000 or 2000.
At the machine-code level, a pointer is essentially an integer-sized value interpreted as an address. The CPU loads that value into a register and then uses it to access another memory location. Registers are small storage locations inside the CPU rather than ordinary memory addresses, so they provide a practical endpoint to the lookup process.

Related Questions
How To: Running Codex CLI on Windows with Azure OpenAI
Set Wordpress Featured Image Using Javascript
How To Fix PHP Random Being The Same
Why no WebP Support with Wordpress
Replace Wordpress Cron With Linux Cron
Customize Yoast Canonical URL Programmatically