I am new to C++, but I met an issue:
const int* pp2;
int p2;
pp2 = &p2;
this is right, but the same rule for this code:
const int** pp2;
int* p2;
pp2 = &p2;
this is an error:
error: invalid conversion from ‘int**’ to ‘const int**’ [-fpermissive]
I am confused.
int*
can be casted to const int*
, but why int**
can't be casted const int**
?