   Int Main() Question
  Hello,I've been programming for about a month or so and I've had these questions for quite some time now. 1. What does the following arguments in 'int main()' do?2. Is it better to include them in your code?3. Whats the difference between the 2 examples?With Arguments:#include <iostream>using namespace std;int main( int argc, char* argv[] ){   return 0;}Without Arguments:#include <iostream>using namespace std;int main(){   return 0;}Thanks for any help.   
  argc will store the number of arguments to your program. so if you start it withc:\whatever\mycoolprogram.exe tjoho.txtargc would be 2argv[0] would be "c:\whatever\mycoolprogram.exe"argv[1] would be "tjoho.txt"so basically argc and argv are used to grab the commandline arguments passed to your program.   ;  small addition. you can easily test this by making a small program:#include <iostream>using namespace std;int main(int argc, char *argv[]) {    for (int i=0;i<argc;i++) {   cout <<"argv["<<i<<"] = "<<argv<<endl;    }    return 0;};  programs are sometimes run at the command line, the old fashioned way. You run the program by just typing the programs name. If your program was named "test" you would type on the command line: testSometimes when you run the program, you'll also type something else. Like if you had a alarm clock program, you might type the number of hours before the alarm starts beeping. So you would type on the command line: test 4the alarm will start beeping in 4 hours now. In your source code you have:int main( int argc, char* argv[] )argc is the number of extra stuff you typed in addition to the program name. I think in c++ it counts the name of the program itself as an argument. The "char*" is a string. So char* argv[] is an array of strings. This array holds every argument you typed on the command line. So it would hold "test" and "4".now in your main method you could have:int main( int argc, char* argv[] ){   int hoursToWait = argv[1];   //beep alarm clock in hoursToWait hours}   ;  int main( int argc, char* argv[] )so argv[] holds the actual stuff they typed, and argc is just the number of things they typed.   ;  Someone correct me if I'm wrong.  I believe both the signatures for main you provided are correct in standard C++.  Which one you should use depends on if your program needs to use command line arguments.   