Recursive Execution ...

Now (factorial 1) = 1 and our stack looks like:

n = 2
n = 3

We multiply 2 by the value of (factorial 1) and return 2 as the value of (factorial 2):

n = 3

We multiply 3 by the value of (factorial 2) and return 6 as the final value of (factorial 3). Now the stack is empty.

Look back at page trace to see how the trace printout shows the argument values and return values.

Contents    Page-10    Prev    Next    Page+10    Index