jeudi 29 novembre 2018

What's the difference between `auto pp` and `auto *ppp`? [duplicate]

int foo = 11;
int *p = &foo;

auto pp = p;
auto *ppp = p;

cout << pp << endl;
cout << ppp << endl;

This program will produces the same output of pp and ppp,so why? auto deduce the variable should be int, so I think declaration of ppp is right. But pp and ppp have the same value... Output: 0x61fefc 0x61fefc

Aucun commentaire:

Enregistrer un commentaire