I sometimes see main () declared as " int main ( int argc, char * argv ) {} "
I know what argc, and argv are. What I don't understand, though, is that if main () is where the program starts, then who ( or rather, what ) is gonna call "main"? In other words, why would one give main () some arguments?
It's used to give utility programs more instruction. or to get the current version (-v), author(-author), build date(-build), or other such things from the executable, also in the case of some programs on windows you can add extra flags to the windows shortcut so that the program starts up in taskbar, or starts in windowed mode (for games), or starts at a different size resolution to normal... The possibilities are endless...
also to be more precise it's int main ( int argc, char **argv )
or more commonly written int main ( int argc, char * argv[] )
Say you decide to unzip a program from command line, you might give it a couple options such as:
Unzip -v -f somezippedprog.zip
the -v (verbose) -f (force) and the filename (somezippedprog.zip) are 3 arguments that are sent to int main() and it handles these as required.