How is recursion handled internally?
Internally, every recursive call to a function requires storing the intermediate values of the parameters and local variables in a run time stack. The common algorithm for any recursive procedure having the following steps:
1. Save the parameters, local variables and return address.
2. If the base criterion has been arrived, then perform the final computation and go to step 3, or else perform the partial computation and go to step 1 with condensed parameter values (initiate a recursive call).
3. Restore the most newly saved parameters, local variables and return address. Go to this return address.