where does "0x29fee8" come from in this? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

where does "0x29fee8" come from in this?

int score = 5; int *scorePtr; scorePtr = &score; cout << scorePtr << endl; //Outputs "0x29fee8

11th Aug 2018, 8:47 PM
Chillin 420
Chillin 420 - avatar
3 Answers
+ 4
scorePtr stores the address of score. 0x29fee8 is this address
11th Aug 2018, 8:50 PM
Jeremy
Jeremy - avatar
+ 2
if you dont understand how ampersand and pointers work you should probably take another look at the pointers section of the c++ tutorial
12th Aug 2018, 4:58 AM
Fyrahh
Fyrahh - avatar
+ 1
cout << scorePtr << endl; This only shows the memory address that the value is currently stored in (0x29fee8) If you want to show the value stored there then you need to write... cout << *scorePtr << endl;
11th Aug 2018, 11:49 PM
Dominic Nicholas
Dominic Nicholas - avatar