auto n = 1;
auto m = 3;
int* ptr = &m;
const int* const p = &n; // const pointer, const data
* p = 0; // error
p = ptr; // error
const int* q = &n; // non-const pointer, const data
* q = 0; // error
q = ptr;
int* const e = &n; // const pointer, non-const data
* e = 0;
e = ptr; // error
int* r = &n; // non-cosnt pointer, non-const data
* r = 0;
r = ptr;
C/C++ const with Pointers
Tech
C
C++