The task never specified that the program must terminate after 1000.
void f(int n){ printf("%d\n",n); f(n+1); } int main(){ f(1); } (Can be shortened to this if you run ./a.out with no extra params)
void main(int n) { printf("%d\n", n); main(n+1); }