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:
- When the function returns or ends, the stack memory of that function is released.
Stack Memory
Stack memory always starts from high addresses and grows down: