Q:

We may store the address of a const object only in a pointer to const

0

We may store the address of a const object only in a pointer to const.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

const double pi = 3.14; // pi is const; its value may not be changed
double *ptr = π // error: ptr is a plain pointer
const double *cptr = π // ok: cptr may point to a double that is const
*cptr = 42; // error: cannot assign to *cptr

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now