-
- a) It cannot, the line you quote doesn’t change the reference
q, it changesp. - b) No the literal is constant, but
pis a pointer which points at a literal.
The pointer can be changed, what is being pointed to cannot.
q = "world";makes the pointerppoint to something else.
- a) It cannot, the line you quote doesn’t change the reference
-
You seem to think that this code
int i; int &j = i; int k; j = k;is reassigning a reference, but it isn’t.
It’s assigning the value ofktoi,jstill refers toi.
I would guess that this is your major misunderstanding.