Why when you enter another value for the score variable you end up with the same address | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Why when you enter another value for the score variable you end up with the same address

24th Jun 2019, 11:43 PM
Faisal Alghamdi
Faisal Alghamdi - avatar
3 Answers
+ 6
Given you understand Spy's statement, moving to integer pointer example. int *score = new int; *score = 5; *score = 7; The address of both score and what it points to are fixed. The only thing changing is the value stored in the address returned by the new.
25th Jun 2019, 1:29 AM
John Wells
John Wells - avatar
+ 4
Show the code
24th Jun 2019, 11:53 PM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 1
Thanks a lot everyone
26th Jun 2019, 11:59 PM
Faisal Alghamdi
Faisal Alghamdi - avatar