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