This is my code:
int i = 5;
const int * cpi = &i; //pointer to const
int * pi = cpi; //Error: a value of type "const int*" cannot be assigned to an entity of type "int*"
This is my code:
int i = 5;
const int * cpi = &i; //pointer to const
int * pi = cpi; //Error: a value of type "const int*" cannot be assigned to an entity of type "int*"
i
is mutable, cause it is not a const type.
You try to store a int address in a const int address via cpi
.
To solve it you have to actually hand over the values not the addresses.