Stack Memory


By default, every variable in C++ is placed in stack memory.

Stack memory is associated with the current function and the memory's lifecycle is tied to the function:

Stack Memory

Stack memory always starts from high addresses and grows down:

MemoryAddress.png