What is argc, char* argv[1]?

Oct 24, 2015 at 7:36am
Hello everyone!
I know this one might sound stupid but i must ask this one.

I have always known that after
1
2
 #include <iostream>
       using namespace std; 

comes,
1
2
3
4
5
6
7
 int main ()
{
bla bla bla

cin.get();
return 0;
}


But now i see this
1
2
3
4
5
6
7
8
9
10
11
12
13
14
include <iostream>

using namespace std;

int main(int argc, char* argv[])
{
    if (argc > 1)
        cout << "Hello " << argv[1];
    else
    cout << "Hello world!";

    cin.get();
    return 0;
}


1. What is this?
2. What does it do? When do we use it and why int main () suddently takes arguments?

Thanks for your expert opinions.
Last edited on Oct 24, 2015 at 7:40am
Oct 24, 2015 at 7:46am
Oct 24, 2015 at 9:08am
Thanks JLBorges
Topic archived. No new replies allowed.