so that the new function knows where to go after it is done the variables have generally been assigned by the compiler to machine registersand there are certain to be conflicts (usually all functions get some variables assigned to register # )especially if recursion is involved the reason that this problem is similar to balancing symbols is that function call and function return are essentially the same as an open parenthesis and closed parenthesisso the same ideas should work when there is function callall the important information that needs to be savedsuch as register values (corresponding to variable namesand the return address (which can be obtained from the program counterwhich is typically in register)is saved "on piece of paperin an abstract way and put at the top of pile then the control is transferred to the new functionwhich is free to replace the registers with its values if it makes other function callsit follows the same procedure when the function wants to returnit looks at the "paperat the top of the pile and restores all the registers it then makes the return jump clearlyall of this work can be done using stackand that is exactly what happens in virtually every programming language that implements recursion the information saved is called either an activation record or stack frame typicallya slight adjustment is madethe current environment is represented at the top of the stack thusa return gives the previous environment (without copyingthe stack in real computer frequently grows from the high end of your memory partition downwardand on many systems there is no checking for overflow there is always the possibility that you will run out of stack space by having too many simultaneously active functions needless to sayrunning out of stack space is always fatal error in languages and systems that do not check for stack overflowprograms crash without an explicit explanation in normal eventsyou should not run out of stack spacedoing so is usually an indication of runaway recursion (forgetting base caseon the other handsome perfectly legal and seemingly innocuous programs can cause you to run out of stack space the routine in figure which prints out containeris perfectly legal and actually correct it properly handles the base case of an empty containerand the recursion is fine this program can be proven correct unfortunatelyif the container /*print container from start up to but not including end *template void printiterator startiterator endostream out cout ifstart =end returnout <*start+<endl/print and advance start printstartendout )figure bad use of recursionprinting container