What This Is
This is a live terminal recording of a call stack demonstration. Watch function calls stack up frame by frame, and observe how the stack unwinds as each function returns — exactly as your program's runtime manages it.
Key idea: every function call pushes a new frame onto the stack. Every return pops it off. The call stack is just a bookkeeping mechanism — it remembers where to go back.
Call Stack Demo Of Function Program
Use the play button to start. You can pause, seek, and adjust playback speed using the controls at the bottom of the player.
Call Stack Demo Of Recursion Program
Use the play button to start. You can pause, seek, and adjust playback speed using the controls at the bottom of the player.
Key Concepts
Stack Frame
Each function call creates a frame on the stack containing local variables, parameters, and the return address — everything the function needs to run.
LIFO Order
The call stack follows Last In, First Out. The most recent function call is always resolved first before control returns to the caller.
Stack Overflow
When recursion goes too deep without a proper base case, frames keep piling up until the stack runs out of space — a stack overflow.
Return Address
When a function finishes, the CPU reads the return address stored in the frame and jumps back to that exact instruction in the caller.