Whey we cannot Convert pointer to a character ->TO-> a reference to a pointer to a constant character
I am interested in knowing the reason of syntax error when we
Suppose you had
void foo_ptr(const char * & ptr)
{
ptr = "readonlystring";
}
You now call it as
char *ptr;
foo_ptr(ptr);
*ptr = 0;
Suppose no error were raised. You are writing to a read-only string, violating the type system without any casts.
This is basically the CV version of How come a pointer to a derived class cannot be passed to a function expecting a reference to a pointer to the base class?.