In the following code, in line 5, the foo1t
function calls the foo1
function by passing two parameters to it, however, the foo1
function has only one parameter. Is this possible or is the code wrong? If it is possible, I would like an explanation.
1 int foo1t(int n, int resp) {
2 if (n <= 1) {
3 return resp;
4 } else {
5 return foo1(n-1, n*resp);
6 }
7 }
8
9 int foo1(int n) {
10 return foo1t(n, 1);
11 }