When I declare an array in C:
char a[] = "something";
I understand that a is implicitly a const character pointer, i.e. a is of the type: (char * const)
But then why does the following statement result in the compiler warning about incompatible pointer types?
char * const * j = &a;
The only way I've managed to get rid of it is by explicitly casting the right hand side to (char * const *)
.
I hypothesized that &
operator returns a constant pointer and tried:
char * const * const j = &a;
without success.
What is going on here?