Handouts (available on-line): none
In this program we also call func2() directly from main(). In this case, note that the local variables for func2() have exactly the same addresses as the local variables of func1() in the previous call.
Finally, we call func3() directly from main(). Again, the addresses of the local variables for func3() take on the same addresses as the variables for func1() and func2() in previous calls.
This example shows that the locations of the local variables in a function are not fixed and that the same memory locations on the stack are repeatedly used for different functions.
This example explains how each call to a recursive function allocates memory for a new set of local variables.
You should practice writing simple recursive functions. Get used to arguing that the base case is correct. Get used to arguing that the recursive case is correct. Don't get too cute with the base case. It doesn't hurt to have some extra cases even if they don't get used!