Module 8 · Recursion
The Call Stack, Frame by Frame
Free with an accountReading
Kenji shows Amara a short recursive function and bets she cannot say what it prints. Bob answers first: the deepest call sets square last, so every line must say 1.
Checking what this lesson needs for you…
What is inside The Call Stack, Frame by Frame
- One call, one stack frame
- Push and pop: the stack grows with every call
- Amara's paper trace: one row per call
- The return address, honestly
- Read the frames in GCC's own listing
- At -O2 the recursion is gone
- The stack has a limit: measure it
- Why a judged problem states an input limit