Skip to main content

What does "call stack" mean in programming?

A call stack is an area of memory where the program stores information about all active (not yet completed) function calls.

When a function is called:

  1. A new stack frame is added to the stack: it stores the function's arguments, its local variables, and the return address.
  2. When the function finishes, its frame is removed from the stack, and control returns to the place where the call was made.

If a function calls itself many times and the stack overflows, a stack overflow error occurs.

In simpler terms, the call stack is a history of the current function calls, organized on the LIFO principle.

Short Answer

Interview ready
Premium

A concise answer to help you respond confidently on this topic during an interview.