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.