C# recursion stack allocation
<pre><code>void factorial(int n)
{

if(n ==0)
return 1;

int value = n*factorial(n-1);
printf("the value is %d", value)
}
</code></pre>

<p>assume the input the function is 4.</p>

<p>so the number of the calls made is 5.</p>

<p>i wanted to know each time a function is called, how the stack allocation happens. Is it some thing like below happens</p>

<pre><code>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);




}
</code></pre>

<p>my question is for each call, the code is generated like the above mentioned in the stack
}</p>

<p>}</p>
