Pointers section problem | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Pointers section problem

how *p is 2 value however it doesn't take any value at beginning https://code.sololearn.com/cWlqp042XLki/?ref=app

21st Jan 2018, 8:31 AM
ali ebrahimi
ali ebrahimi - avatar
2 Answers
+ 3
p is pointer and it is holding the address of x. If you print p like that, cout<< p; //You see the address of the thing that you assigned. but if you put asterisk sign before p, cout<< *p // it shows you the value of that it is holding. * is dereference operator
21st Jan 2018, 8:35 AM
Mustafa K.
Mustafa K. - avatar
0
thank you mustafa . I think pointers needs more time to understand it.
21st Jan 2018, 8:48 AM
ali ebrahimi
ali ebrahimi - avatar