Skip to content

Pointers in C++ made simple

A short, clear explanation of C++ pointers: addresses, the & and * operators, and the most common pointer mistakes.

Published 2026-11-28

Every variable lives somewhere in memory, and that place has an address. A pointer is simply a variable that stores an address.

& gives you the address of a variable. * follows a pointer to the value it points to. That's the whole core idea.

The biggest mistakes are using a pointer before giving it a valid address, and using one after the memory is gone. Set unused pointers to nullptr.

int score = 90;
int* p = &score;   // p stores score's address
*p = 95;           // changes score to 95
← All posts