int main(int argc, char * argv[]) PROBLEM

Hi
I want to know what is difference if in our code and in main function , we use int main(int argc, char * argv[]) instead of int main() ?
in other words : does it have a extra feature for us ?
thanks
the (int argc, char * argv[]) stuff gives you the data passed to the commandline. So for example if the program is executed with the below commandline:

yourprogram somefile.txt -option1

then you'll have:

argc = 3
argv[0] = "yourprogram"
argv[1] = "somefile.txt"
argv[2] = "-option1"

If you are not using any information passed to the command line, then you can use the shorter int main().
Topic archived. No new replies allowed.