0
What is void main() in c++ especially main () function.
3 Respuestas
+ 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;
}
+ 1
It's the infinite loop that contains your program while it's running. The entry and exit point of the program.