There is no default argument to the main function in C. Every C program must have one (and only one) main function. The standard dictates that the main function may have either of the following definitions:
int main (void) {/*...*/}
int main (int argc, char** argv) {/*...*/}
The first version is used when your program does not require any command-line switches. Note that int main () is an acceptable declaration of the main function in both C and C++, but is not a valid definition in C. Note also that, in C, the return type may be declared void, but not in C++.
The second version is more common. The argc argument holds the count of all arguments in the argv array and is always at least one. The argv argument refers to an array of char pointers to null-terminated character arrays thus all arguments are strings. Thus the value 42 will be passed as the string "42".
The first element, argv[0], is always the fully-qualified path to the program executable (hence argc is always at least one). As well as allowing your program to determine its physical location upon the system, it allows your program to determine its given name even if the user has renamed your executable. This is useful when printing error messages.
Any additional arguments passed from the command-line will be found in elements argv[1] through argv[argc-1]. The final element, argv[argc], is always nullptr.
int main( void )
-its a default main function.
int main( int argc, char *argv[] )
-The variable argc never holds a negative value.
int main( int argc, char *argv[], char *envp[] )
-envp is pointer constant.it have string values.
You will be surprised: it's main.
Every C program must have a function, named main(), which is where the program starts execution. If there is no function main(), the computer does not know where to start running the program. The function main() must also do something; if it is just empty, some smarter compilers will note that there is nothing for the program to do, and will give this sort of error message to indicate that you forgot to tell the program what to do.
Actually, it is:int main (void)orint main (int, char **)the point where the execution of the program begins
The execution of the program starts with function main, wherever it is in the source.
The main function. Every program must have a main function and it must be declared static.
A main function must be present in every C program.
Every C program must have a function, named main(), which is where the program starts execution. If there is no function main(), the computer does not know where to start running the program. The function main() must also do something; if it is just empty, some smarter compilers will note that there is nothing for the program to do, and will give this sort of error message to indicate that you forgot to tell the program what to do.
It is the first function that gets called when the program is executed.
It's called 'main' by tradition; this feature lets the linker to know, where to start the execution.
Actually, it is:int main (void)orint main (int, char **)the point where the execution of the program begins
The execution of the program starts with function main, wherever it is in the source.
You're supposed to do your homework yourself. (Mind you, you have to hav at least one function called main.)
main() is so special because it starts the execution of program. or we can say that it is entry gate of any programming language
The main function is the entry point into a program. When the Operating System launches the program the main function gets executed.
to pump blood throughout the body and keep you alive.
The main function. Every program must have a main function and it must be declared static.
A main function must be present in every C program.
Into the source program.