+ 1

Can someone help me please. I can understand the result of the cout << p << endl; #include <iostream> using namespace std; int main() { int x = 8; int *p; p = &x; cout << *p << endl; cout << p << endl; cout << &p; return 0; }

16th Aug 2016, 4:07 PM
Attitude
Attitude - avatar
6 Réponses
+ 3
thank you for answer me Dev. According to what i read, i understand. So, When i run it, it gives me: 8 the memory adress of x the memory adress of p
16th Aug 2016, 4:49 PM
Attitude
Attitude - avatar
+ 1
pointer are memory location of x
16th Aug 2016, 4:52 PM
Pickle_Rick()
Pickle_Rick() - avatar
+ 1
*p is value of adress that p holds. p holds adress of x (pointer of x) so *p is value of x (8). p is address of x (pointer of x). &p is adress of p (pointer of p)
17th Aug 2016, 3:35 PM
Bekir Uzun
Bekir Uzun - avatar
0
it may be 8 8 8
16th Aug 2016, 4:29 PM
Dev Singh
Dev Singh - avatar
0
Yes, pointer is the memory adresslocation of x it's because after we declare int*p, we affect p the adress of the variable x by wrinting p=&x.
16th Aug 2016, 5:08 PM
Attitude
Attitude - avatar
0
Merci Bekir
17th Aug 2016, 3:38 PM
Attitude
Attitude - avatar