Limited recursion in C?
Posted
by
function
on Stack Overflow
See other posts from Stack Overflow
or by function
Published on 2011-06-24T20:15:40Z
Indexed on
2011/06/25
0:22 UTC
Read the original article
Hit count: 130
c
I ran this program and it output
...
65088
65089
65090
and then it stopped. Windows 7 said a.exe stopped working. Here is the code:
#include <stdio.h>
void go(void);
main()
{
go();
}
void go(void)
{
static int i = 0;
printf("%d\n", i++);
go();
}
I think this program should keep on printing numbers indefinitely due to recursion, but it stops at 65090! The C code is compiled with gcc. Any ideas?
© Stack Overflow or respective owner