143 views
#include<iostream>
using namespace std;

int i=0;
void a()
{
i+=1;
cout<<i<< ".hello"<<endl;
a();
}

int main()
{
a();
}

For this above code the output is only upto →  64891.Hello

Does this mean that that the stack can hold only 64891 recursive calls? (I am using dev c++)

retagged | 143 views
0
showing error :(
0
It runs perfectly in dev c++ .. 😶
0
how?? dry run code and tell me how running correctly?
0
we are calling a() infinite times and it prints.. 1.hello 2.hello 3.hello and so on
0
yes, then is it not stack overflow error??
0
ya..it is stack overflow..but output should be printed upto a certain point right?
0
upto infinity, no certain point there
0
dev gives output upto 64891.. and my question is also based on this that why upto 64891? is the stack capacity only that?
0

43169.hello

--------------------------------
Process exited after 54.19 seconds with return value 3221225725
Press any key to continue . . .

mine exited like this

+1 vote
I run the same code in ubuntu terminal and each time I executed the code, it shows me a different value of 'i' around 5 lakhs with a message segmentation fault (core dumped)
by (33 points)