Foundamental Structure of Programs

Callstack

Posted by Rico's Nerd Cluster on May 1, 2024

Callstack

A callstack is a stack of frames, where a frame represents an active call. Each frame has: return address (where the function returns after it completes), local variables.

E.g., if function A -> B -> C. it will look like:

1
2
3
[ Frame for function C ] <-- Top of the stack
[ Frame for function B ]
[ Frame for function A ] <-- Bottom (or base) of the stack