i am trying to understand int main( argc, char* argv[])
thing.
When i using arguments like ./program 1 bbbbbb
code:
cout<< argv[0] << ' ' << argv[1] << ' '<< argv[2] << endl;
will show: ./program 1 bbbbbb
but in this case:
cout<< *argv[0] << ' ' << *argv[1] << ' '<< *argv[2] << endl;
will show: . 1 b
SO my question is. Is this char* argv[]
in this situation an array of pointers. And how to get access for strings like bbbbbbb
.
Ty in advance!
In this case
char* argv[]
is an array of null terminated strings.Specifically as per ยง5.1.2.2.1/2 of the C standard:
And:
My suggestion is to do what C++ unfortunately fails to do due to backward compatibility:
and here's the live demo.