void factorial(int n)
{
if(n ==0)
return 1;
int value = n*factorial(n-1);
printf("the value is %d", value)
}
assume the input the function is 4.
so the number of the calls made is 5.
i wanted to know each time a function is called, how the stack allocation happens. Is it some thing like below happens
void factorial(4)
{
if(4 == 0)
return 1;
int value = 4*factorial(3)
printf ("the value is %d",value);
}
void factorial(3)
{
if(3 ==0)
return 1;
int value = 3* factorial (2);
}
my question is for each call, the code is generated like the above mentioned in the stack }
}