int f(int x)
{
If (x==0)
{
Returns1;
}
other
{
Returns x * f (x-1);
}
}
Suppose f(3)
therefore
The first time f(3):x! =0, call f(2)
The second f(2):x! =0, call f( 1)
The third f( 1):x! =0, call f(0)
The fourth f( 1):x==0, and returns 1.
Call f( 1) for the third time: return1*1=1;
Call f(2) for the second time: return 2 *1= 2;
Return the first call f(3): return 3 * 2 = 6;
The result of f(3) is 6.