So, I have this code fragment:
int * iPtr ;
int * jPtr ;
int i = 5, k = 7;
iPtr = &i;
jPtr = iPtr ;
I have just started learning about pointers, and need to get some doubts cleared.
- is jPtr now essentially also pointing at i?
- I know I can change the value of i by using *iPtr, but how can I change the value of the object being pointed to by jPtr?
- How will changing the object being pointed to by jPtr affect the value of the object pointed to by iPtr, and i ?
1 Answer