0 votes 0 votes #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++) Programming in C algorithms programming-in-c recursion + – Hirak asked Jun 2, 2019 • recategorized Jul 6, 2022 by Lakshman Bhaiya Hirak 1.2k views answer comment Share Follow See all 9 Comments See all 9 9 Comments reply srestha commented Jun 2, 2019 reply Follow Share showing error :( 0 votes 0 votes Hirak commented Jun 2, 2019 reply Follow Share It runs perfectly in dev c++ .. 😶 0 votes 0 votes srestha commented Jun 2, 2019 reply Follow Share how?? dry run code and tell me how running correctly? 0 votes 0 votes Hirak commented Jun 2, 2019 reply Follow Share we are calling a() infinite times and it prints.. 1.hello 2.hello 3.hello and so on 0 votes 0 votes srestha commented Jun 2, 2019 reply Follow Share yes, then is it not stack overflow error?? 0 votes 0 votes Hirak commented Jun 2, 2019 reply Follow Share ya..it is stack overflow..but output should be printed upto a certain point right? 0 votes 0 votes srestha commented Jun 2, 2019 reply Follow Share upto infinity, no certain point there 0 votes 0 votes Hirak commented Jun 2, 2019 reply Follow Share dev gives output upto 64891.. and my question is also based on this that why upto 64891? is the stack capacity only that? 0 votes 0 votes hitendra singh commented Jun 2, 2019 reply Follow Share 43169.hello -------------------------------- Process exited after 54.19 seconds with return value 3221225725 Press any key to continue . . . mine exited like this 0 votes 0 votes Please log in or register to add a comment.
1 votes 1 votes 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) SHRIHARI NAIK answered Jul 31, 2019 SHRIHARI NAIK comment Share Follow See all 0 reply Please log in or register to add a comment.