int main()

Mar 29, 2009 at 7:57am
Hello,

Ive seen int main() written like this, int main(int argc, char *argv[]) or in this fashion a lot, and i was curious what the purpose of writing it like that is, compared to just simply writing int main().

this has just been somthing that has been on my mind a bit, and would appreciate any help as to what the difference and benefit to doing so is,

Thanks,
Sabal
Mar 29, 2009 at 9:30am
If the program is called with parameters, argc saves the number of parameters and argv saves the parameters.
This was often used for DOS programms but today it's not realy usual.

I hope I could help you.

Greez
BlackMark
Mar 29, 2009 at 10:25am
It may not be so common for Windows but command line parameters are very common in the world of UNIX. And relatively big number of Windows applications accepts them too, they are not just so commonly used by average end users.
Last edited on Mar 29, 2009 at 10:26am
Mar 29, 2009 at 1:09pm
Also in Windows program arguments are important, an example could be when the program is launched when opening a file
Last edited on Mar 29, 2009 at 1:09pm
Topic archived. No new replies allowed.