The Importance of the main() Function in C Programming

All C language programs must have a main() function. It's the core of every program. The “main ()” function indicates the beginning of a C++ program is executed, the control goes directly to the main() function. The statements within this function are the main body of the C++ program.  If main() function is not indicated, the program is not compiled and an error message is generated. It contains instructions that tell the computer to carry out whatever task your program is designed to do. But it's not officially required to do anything. The main() function uses its parentheses to contain any information typed after the program name at the command prompt. This is useful for more advanced programming. The name main is special, in that the main is actually the one which is run when your program is used. A C program is made up of a large number of functions. Each of these is given a name by the programmer and the refer to each other as the program run.

Comments