Character Array MCQ 14 : Printing String Recursively
What is the Output of the Following Program ?
printf("\nI am in Main");
- 1.I am in MainI am in Main—- Infinite Times
- 2.I am in MainI am in Main—- 10 Times
- 3.I am in MainI am in Main—- Until Internal Stack Overflows
- 4.None Of These
Switch to String MCQ Home : Click Here
- Function Does Not Remember Values Initialized Inside Calling Function except Static Variable.
- So After Printing Message , again main() Function gets Called Where again i becomes 0
- Thus This Program Runs Forever , Theoretically This Program Prints Message Infinite Number of Times
- While Calling Recursive Function Contents are Pushed onto Internal Stack When This Internal Stack Overflows Program stops
- We can Terminate Program Execution by Pressing Ctrl+Pause/Break