0

What is void main() in c++ especially main () function.

8th Dec 2017, 1:55 PM
Rahul
Rahul - avatar
3 Réponses
+ 4
main is the default entry point of a C (and C++) program. The correct signature of the function is: int main(int argc, char **argv, char **envp); and in C++ it's treated as a special case, defined automatically as extern "C" to keep the symbol name free from name mangling The Main Function. In C and C++, the "main" function is treated the same as every function, it has a return type (and in some cases accepts inputs via parameters). The only difference is that the main function is "called" by the operating system when the user runs the program ex:- int main(void) {  puts("Hello World!!"); /* prints Hello World!! */ return EXIT_SUCCESS; }
8th Dec 2017, 2:01 PM
GAWEN STEASY
GAWEN STEASY - avatar
+ 1
It's the infinite loop that contains your program while it's running. The entry and exit point of the program.
8th Dec 2017, 1:59 PM
AgentSmith