GeeksforGeeks » C/C++ Programming Questions

Recursion of main()

(2 posts)

Tags:

  1. recursion
    guest
    Posted 1 year ago #

    #include<stdio.h>
    #include<conio.h>
    static int i;
    int main()
    {
        if(i==5)
           printf("\n thanks...");
        i++;
        return (i=main());
    }

    When i run this program it is showing the output as thanks... But it is still in the output window and i am not able to get back to the program window.. why is it so ? Can you explain please..

  2. kapil
    guest
    Posted 1 year ago #

    Because there is no recursion termination condition


Reply

You must log in to post.

RSS feed for this topic