Consider the following function:
int mystery(int a, int b) {
if (b == 1)
return a;
else
return a + mystery(a, b - 1);
}
What is the return of calling mystery(2,0)?
(Either write a number, or write "infinite recursion".)
infinite recursion
Initially b = 0, and the recursive function keeps on decrementing b. Do you think that it will ever reach the base case?