Syntax of C main() Function
return_type main() { // Statement 1; // Statement 2; // and so on.. return; }
We can write the main function in many ways in C language as follows:
int main(){} or int main(void){}
main(){} or void main(){} or main(void){} or void main(void){}
In the above notations, int means integer return type, and void return type means that does not return any information, or (void) or () means that does not take any information.
main Function in C
The main function is an integral part of the programming languages such as C, C++, and Java. The main function in C is the entry point of a program where the execution of a program starts. It is a user-defined function that is mandatory for the execution of a program because when a C program is executed, the operating system starts executing the statements in the main() function.