C Call Stack
1. What is a stack frame?
Stack Frame is actually a buffer memory that is an element of the program stack and has data of the called function, i.e.:
- Return Address
- Input Parameter
- Local Variables
- Register Savings
2. What happens when we call a function?
Whenever a function is called a new stack frame is created with all the function’s data, and this stack frame is pushed into the program stack, and the stack pointer that always points to the top of the program stack points to the stack frame pushed as it is on the top of the program stack.
Function Call Stack in C
A function in C is a set of code that performs a specific task and can be used whenever needed just by calling it. But how the function call works and how the data of the function is stored in the memory is an area of interest for a better understanding of the concepts such as recursion.