I have following code:-
static char* ListOfStr[] = { "str1", "str2", "str3" };
void Foo(const char** listOfStr)
{
// do something
}
When I call Foo
like;
Foo(ListOfStr);
I get Error Can not convert char** to const char** (C2664 - vc++)
I know how to solve the problem using casting or other way around like defining const array at first place.
But isn't it safe to use char** as const char** than why it gives error ?
I supposed there should be auto convertion like std::string
to const std::string
when passing to function. Only the reverse of this cont char**
to char**
must give the Error without cast.