You are accessing a array of strings. The []
represents the array and the char *
represents the string. This is necessary because the command line can pass several arguments, and all are strings.
In C there is no string with its own concept, it is usually represented by a array or the most common character pointer.
So it’s two different things, so it needs to be used this way.
In C it’s rare, but some do typedef string char *;
to use string
in place of char *
.
If it were
int main(int argc, string argv[])
I put in the Github for future reference.
would you understand? It’s the same thing.
Can’t access without the pointer array of characters and not a array of strings, which is what is expected. Actually you can access, but it won’t be what you expect. You have to use the right type for what you need.