Possible Duplicate:
Why can’t I convert ‘char**’ to a ‘const char* const*’ in C?
I am curious, why can't I pass a char **
to const char **
function? Where as it is OK to pass char *
to a const char *
function it seems not to be OK to do it with double pointers. I thought it was always ok to add constness (but not ok to drop constness) but now it seems I have been wrong.
Gcc compiler is giving me the errror:
note: expected ‘const char **’ but argument is of type ‘char **’
Here is the code snippet:
int f(const char **a) { }
int main() {
char *a;
f(&a);
}
Any ideas?