Register now or log in to join your professional community.
main() is a predefined function. when a program is set to compile. Compiler First looks for the main Function. Compiler starts compiling from main function
Main is Predefined/System function. When operating system handover the control of program, it looks for the main() function in the program. You can say it is a entry point of the your program.
Prototype for the function is predefined for the function but the actual task of the main() is defined by the user.
In C programming Language main(0 function is user implemented (user defined) whose declaration is fixed in the compiler. hence we can say that main() is predefined and user defined too because programmer has to write function's body.
Here is the complete article on it.
Is main function in C programming language predefined or user defined?
When u compile and execute a C program, the first thing your compiler or OS looks for in a program is the main() function..this is because all programs no matter how much complex start at the main()main() is a predefined function which can take only two arguments as: main(argc, char *argv[ ]) argc = count of arguments
argv[ ] = is an array of strings or an array of char pointers
these are also known as Command Line Arguments
Moreover you usually do not use these arguments unless you want to supply arguments form the command line itself.
main() is predefined function whose prototype is such that it can accept only two arguments and return integer. User can neither modify number of arguments it takes nor return type.
Main Function is user derive function. only one main function in the program code.