0
How does p = q; *p = 2; work?
I don't understand how q is reassigned a new number. https://code.sololearn.com/cOaDKp7u4ilw/?ref=app
4 Antworten
+ 2
Here is what the program is doing:
(int *p) p is a pointer, it stores the memory address of i
(int *q) q is a pointer, it stores the memory address of j
(p=q) now p stores the same value stored by q: the memory address of j
(*p=2) the memory address pointed by p now stores 2, that means j=2
+ 1
Yes, if you want check out this too
https://www.sololearn.com/post/897320/?ref=app
0
Is it something like this?
https://www.sololearn.com/post/897256/?ref=app
0
Thank you, Angelo.