Recursion Quiz Doubt

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

#include
using namespace std;
int cnt=0;
void myrecursivefunction(int n)
{
cnt++;
if(n == 0)
return;
printf("%d ",n);

 myrecursivefunction(n-1);

}
int main()
{
myrecursivefunction(10);
cout<<cnt<<endl;
return 0;
}

cnt is clearly 11.

Yes your are correct. Answer should be 11. There are some issue with the quiz section . We will correct it.

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.