+ 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; }
6 Respostas
+ 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
+ 1
pointer are memory location of x
+ 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)
0
it may be
8
8
8
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.
0
Merci Bekir