Next: A warning Up: How automatic variables Previous: Creating and deleting

Recursion

Recursion is handled in the same way. A new stack frame is created for each call, both the original and all subsequent recursive calls. More importantly, a new set of linkages is created each time too, so it does not matter that the automatics have the same name every time: they are linked to different stack frames and therefore to different pieces of memory.

Try drawing the stack, at least for the automatics, in our printd routine with n=123.



Next: A warning Up: How automatic variables Previous: Creating and deleting


maspjw@
Tue Sep 27 15:29:34 BST 1994