As we know in reference, a const can have a reference to either a const or non-const. However I have a question for the following pointer:
#include<iostream>
using namespace std;
int main() {
const double pi = 3.14;
const double *cptr = π //we point to a const double (above)
double dval = 3.14;
cptr = &dval;
cout<<*cptr<<endl;
}
What I am not understanding is "const double *cptr" if we read it from right to left we have cptr is a pointer that points to a const double.
However, below we have double dval = 3.14; with cptr = &dval; double dval is not a constant, from what I am understanding we can still point to a non constant correct?