If I have to assign a pointer to constant char or int variable, what is the difference between the following assignments:
char x{'a'}; // declare and initialise a char variable
const char *p = &x; // assign the address of the char to constant pointer
But the following doesn't compile:
const char x{'a'};
char *p = &x; // assign the address of the constant char to non-constant pointer
This produces an error: invalid conversion from ‘const char*’ to ‘char*’
I am missing something in understanding this behaviour.