Some key traits of the call stack:
- The call stack is Last In, First Out. Function calls are added to the top of a “pile,” and whatever’s on top of the pile is always called before what’s below it can be called next. It’s similar to stacking dishes - the last one you put on the pile is the first one you use later on.
- A stack overflow is when the call stack limit is exceeded. Recursive functions (functions that call themselves) can trigger a stack overflow when there’s no end coded into it. Whatever’s running this code will ultimately crash.