Pointers and Dynamic Memory

Lesson 11 of 20

Meet the heap: new hands you memory by address, delete takes it back, and every hop is visible in 3D.

The big picture

Why pointers?

A pointer does not hold data — it holds the address of data. That one twist unlocks the heap.

Pointer = address

A pointer variable stores the location of another variable, not a value itself.

& reads an address

&box asks "where does box live?" — the answer is what a pointer stores.

* follows the address

*p travels to wherever p points and reads or writes the value there.

new and delete

new reserves memory on the heap at runtime; delete hands it back. You are the cleanup crew.