+ 5

Pointer and reference to it???

I have the following code: int *ptr = new int; *ptr = 5; cout << ptr << endl << *ptr << endl << &ptr << endl; Output: 0x26A9D8 //it address to variable 5 //it variable's value 0x14FA10 //but what is it? Address of *ptr?

26th Feb 2017, 7:18 PM
Макс Елисеев (WMax)
Макс Елисеев (WMax) - avatar
3 odpowiedzi
+ 8
You should look this page, here they explain what & and * means in C++ : http://www.cplusplus.com/doc/tutorial/pointers/ Hope it helps 😉
26th Feb 2017, 8:32 PM
C.E.
C.E. - avatar