LESSON · 1 OF 26

What is a pointer

What is a pointer

Every variable lives somewhere in memory, and that location has an address. A pointer is a value that holds one of those addresses. Instead of storing a number or a string directly, a pointer stores "the thing you want is over there".

Think of a variable as a labelled box holding a value. A pointer does not hold the value itself - it holds directions to the box. That indirection is the whole idea, and everything else in this topic builds on it.

Why this matters

Once you can name the address of a box, you can hand that address to code in another part of the program and let it read or change the same box. A plain copy of a value cannot do that. The rest of these lessons show how to take an address, follow it, and use it.

Spin up a fresh environment and practice live.
go · fresh machine · ready in under a minute