Apart from other mentions that you can pass char**
into function that takes const char **
,
const char**
is a non-const pointer to const char*
, you can declare it and freely put values of type const char*
in it.
On the other hand, you would not be able to do it, if you declared it as const char * const *
or const char * const * const
.
yourfunc(const char **p);
...
const char *array_str[10];
array_str[0] = "foo"; /* OK, literal is a const char[] */
yourfunc(array_str);
Here is what cdecl
says:
cdecl> explain const char **table
declare table as pointer to pointer to const char
cdecl> explain const char * const *table
declare table as pointer to const pointer to const char
cdecl> explain const char * const * const table
declare table as const pointer to const pointer to const char