I am having trouble with it,
I have used some code to test it.
In Microsoft Visual C++ 6.0 and Mingw gcc,it could work.
But does standard C or standard C++ support function main or other functions calling main?
I have found the result in some books,and see some examples.
But they have not said "standard c/c++ support it" ?
3Q if you can answer my question.
main() should never call itself and no other function should call it either. If the C/C++ standard says it's possible, doesn't mean it's a sane thing to do.
The C language standard allows recursive calls to main().
The C++ language standard explicitly prohibits calling main() from itself or from any other user-created code.
To quote the C++ standard, §C.1.2/3.6 "C++ and ISO C"
Change: Main cannot be called recursively and cannot have its address taken
Rationale: The main function may require special actions.
Effect on original feature: Deletion of semantically well-defined feature
Difficulty of converting: Trivial: create an intermediary function such as mymain(argc, argv).
How widely used: Seldom