More you share, more you have!!!

More you share, more you have!!!

What will happen if we call main within main in C language?

main-within-main


Answer:

Let us write C program for it,

#include<stdio.h>

#include<conio.h>

int x=0;

void main()

{

printf("Main calling-%d", x);

x++;

main();
}


Output :

It will go into infinity loop as it creates cycle (main again main).


Share on Google Plus
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment