Visualize

Stack vs heap

Frames that vanish, blocks that stay, made visible. Change the inputs and step through it.

Stack vs heap: what it shows

The stack holds each function's local variables and frees them automatically when the function returns; the heap holds blocks you ask for with malloc and must give back with free. Step through calls and returns and watch both sides change.

See also