How Pointers Work

A pointer is a variable that stores another variable's address. Assigning x's address to pointer p makes p point at x. Writing *p, with a * in front of the pointer, dereferences it — retrieving the value it points to. Redirecting the pointer to a different variable changes what *p gives back too.

GOAL

Explain how a pointer stores a variable's address, and how dereferencing retrieves its value.

When p points to x, what value does *p give?