How many times can I use MAIN in my C++ program?
Can I declare it as a variable and use it?
As main() is only one time allowed...
Printable View
How many times can I use MAIN in my C++ program?
Can I declare it as a variable and use it?
As main() is only one time allowed...
You can use MAIN if you want, since it's not main (case-sensitive).
Why, though? Also, most coding conventions have anything in ALL CAPITALS as either a preprocessor macro, or a constant of some kind.
Its one of the questions my brother gets at some exam tomorrow...
Well, you can use MAIN as a function, variable, whatever, if you wanted. You could still only use that name once though (within the same namespace).