mardi 23 janvier 2018

What's meaning of &&pointer or &*(pointer_to_pointer) in C++

int *p;
int **pp;
int a = 9;
p = &a;
pp = &p;

cout << "&a: " << &a
cout << "&p: " << &p
cout << "&pp: " << &pp
cout << "pp : " << pp
cout << "*pp: " << *pp
cout << "&*pp: " << &*pp

&&p and &&pp aren't defined in c++ so they are wrong using, but what &*pp is meaning? Is &*pp equalent to &&a?

When the program is starting, the result is as follows:

&a:   00AEFAE4
&p:   00AEFAFC
&pp:  00AEFAF0
pp :  00AEFAFC
*pp:  00AEFAE4
&*pp: 00AEFAFC (=&p ???)

On the other hand, why is &*pp equalent to &p?

Aucun commentaire:

Enregistrer un commentaire