Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

calling main() in main() in c

Tags:

c

Is it possible to call main() within the main() function in c?

like image 981
anant Avatar asked Nov 21 '10 13:11

anant


People also ask

What would happen if main () main (); is executed?

It will allow the module and its functions and classes to be imported into other scripts without running the main function, and will also allow the module (and its functions and classes) to be called when running from a different '__main__' module, i.e.

Can we call main method inside main method?

Solution: Though Java doesn't prefer main() method called from somewhere else in the program, it does not prohibit one from doing it as well. So, in fact, we can call the main() method whenever and wherever we need to.

Can main function call itself?

The main() function can call itself in C++. This is an example of recursion as that means a function calling itself. A program that demonstrates this is given as follows.

Can I call main () in C++?

In practice, can you call main() ? Yes.


1 Answers

Yes, C allows you to call your main function (while C++ does not )

like image 82
nos Avatar answered Oct 08 '22 21:10

nos