A process running the following code has 1KB memory allocated for the stack region.
int iFactorial (int iNum)
{
if (iNum==0)
return (1);
else
return (n*iFactorial(n-1));
}
The function is called iFactorial(257). Assuming that an integer takes 4 bytes on your machine and operating system,
find the number of times recursion will happen before a "stack overflow" occurs.
a) 256
b) 257
c) 1024
d) None of the above
int iFactorial (int iNum)
{
if (iNum==0)
return (1);
else
return (n*iFactorial(n-1));
}
The function is called iFactorial(257). Assuming that an integer takes 4 bytes on your machine and operating system,
find the number of times recursion will happen before a "stack overflow" occurs.
a) 256
b) 257
c) 1024
d) None of the above