+ 3
Time limit exceeded in calling main function.
Can anyone say what is wrong in this https://code.sololearn.com/cDV8MObLBF36/?ref=app
8 Answers
+ 4
Harsh because of how post-increment works, if you put i++ in the condition, main will be called and "i" will never actually increase
+ 3
line 15 never gets executed and they create something like infinite loop
It should work correctly if you remove line 15 and change line 13 to if(i++==1)
+ 3
but why i++ never get executed
+ 3
because(i think) main function never finishes
+ 3
:-O
+ 2
oh yes! you are absolutely correct. When main is called, the controller move to main() and i++ does not get executed.
Thank you
+ 1
Mert
now check my program, I had put i++ above and it worked. How??? and why not before???
https://code.sololearn.com/cDV8MObLBF36/?ref=app
0
Agent
I want to call main from function.