Possible Duplicate:
Runtime exception, recursion too deep
I'm getting a problem while developing a c#.net program and I've simplified it to a simple problem, I need to understand why does this code throw a stackoverflow exception if I call the function like this :
CheckFunc(16000);
but works fine if I call it like this
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 it can get...
I understand that there is a stack that gets overflowed but which stack ? How can I fix this ?
Thanks.