ProAnswers.org

Can I use main function more than one in a C program?

2 Likes

sorry… we can not use main() more than once…

actually when you use main() again in c program it call the main() Recursively, NO termination…

the stack gets overflow due to this…

so we cant use main() more than once in c program.

The number of main funcation in a programme always use one

actually we cant use the main() function twice because the compiler cant be understand that from which main() it has to be executed the program… as the main() function is the staring point for execution of the program in c…

but we can recursively call the main() function..... here also a problem occour during call its store in a stack.... in a cirtain situation the stack may be overflow.....