fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. struct VecP
  5. {
  6. char *name;
  7. VecP() {
  8. name = new char[ 10 ];
  9. }
  10. ~VecP() {
  11. delete [] name;
  12. }
  13. };
  14.  
  15. struct VecC
  16. {
  17. char name[ 10 ];
  18. };
  19.  
  20. int main() {
  21.  
  22. VecP a;
  23. VecC b;
  24.  
  25. cout << (unsigned long long) a.name << ", "
  26. << (unsigned long long) &(a.name) << ", "
  27. << (unsigned long long) &a << endl;
  28.  
  29. cout << (unsigned long long) b.name << ", "
  30. << (unsigned long long) &(b.name) << ", "
  31. << (unsigned long long) &b << endl;
  32.  
  33. return 0;
  34. }
Success #stdin #stdout 0s 4784KB
stdin
Standard input is empty
stdout
94860714372720, 140735927678032, 140735927678032
140735927678046, 140735927678046, 140735927678046