This question already has an answer here:
- What does the auto c++ keyword do? [duplicate] 2 answers
- What is the point of the 'auto' keyword? 7 answers
- C++ auto keyword. Why is it magic? 5 answers
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