You need input arguments if you want your program to get some data from the command line. For example, you can run smth like this in the Command Prompt
./test arg1 arg2
In you have int main( int argc, char* argv[] )
declared you'll get argc
= 3 and argv
is an array of chars representing each element {test, arg1, arg2}.
If you don't want you program to get any user console input just declare it as int main( )
.
Think of main
as an entry point for your program, the point from where execution takes place. On some embedded platforms you can name your entry point whatever you like (i.e. int superPuperMain()
).
The return code of main
is treated when you launch your program from some script and you are interested in the return code of it. Think of your program as a function with return code here. Of course it's not correct but it gives you a general feeling about it :).