Call Stack
Domain: Programming Fundamentals
π― Motivation
Every function call adds a frame to the call stack. When functions return, frames are removed. Too many = overflow.
π Concrete Example
Calling f() which calls g() which calls h() - the stack is [f, g, h]. When h returns, itβs [f, g]. When g returns, itβs [f].
π Analogy
A stack of plates - you add a plate on top (call) and remove from the top (return). Last plate on is the first off. Too many plates = the stack falls over (overflow).