main() function in C
What is 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.
Syntax of C main() Function
return_type main()
{
// Statement 1 ;
// Statement 2 ;
// and so on..
return ;
}
Types of C main Functions
Main function with no arguments and void return type
void main() { // Function body }
int main() { // Function body }
int main(int argc, char* argv[]) { // Function body }
Comments
Post a Comment