In command line arguments why can't we use string *arr
instead of char **arr
You could if your compiler supports such parameters for main
.
But the language standard doesn't require supporting such parameters, and I know of no compiler that does. So, you cannot use that because your compiler doesn't support it.
What is the difference between char**
and string*
char**
is a pointer to char*
. char*
is a pointer to char
. char
is a funcamental type, an integer type and a character type which represents an encoded narrow character.
string*
is a pointer to string
. There is no such thing as string
in the global namespace at all. There is std::string
which is not a pointer, nor any fundamental type but a class type instead. It is defined in the header <string>
of the standard library.
isn't a string
just a char*
?
No, it is not. See above.