Possible duplicate:
Runtime exception, recursion too deep
I have a problem when developing an aC # .net program, and I simplified it to a simple problem, I need to understand why this code throws a stackoverflow exception if I call the function as follows:
CheckFunc(16000);
but it works fine if I call it that
CheckFunc(1000);
here is the function:
private void CheckFunc(Int32 i)
{
if (i == 0)
MessageBox.Show("good");
else
CheckFunc(i - 1);
}
tried to make the code as simple as possible ...
I understand that there is a stack that overflows, but which stack? How can i fix this?
Thank.
source
share