Wrong answer of the question

How many times is the recursive function called, when the following code is executed?

void myrecursivefunction(int n)
{
if(n == 0)
return;
printf("%d ",n);
myrecursivefunction(n-1);
}
int main()
{
myrecursivefunction(10);
return 0;
}

is the answer wrong ?
isn’t it should be 11

@harshit_2234
the first call is for 10, from the main function.
then recursive calls are made for 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 and when 0 is reached, the function returns.
So the total number of recursive calls will be 10.

The answer is coming out to be 12

@harshit_2234 i’ll report it to the team, it should not be 12.

yeah , it should be 11

1 call for 10 and then 9 8 7 6 5 4 3 2 1 0
total=11

@harshit_2234 you are correct. Please mark this doubt as resolved in case of no further queries.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.