fork download
  1. #include <iostream>
  2. #include <vector>
  3. #include <type_traits>
  4.  
  5. int main()
  6. {
  7. using namespace std;
  8. vector<int> vect = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
  9. auto pvect = &vect;
  10. auto pvect0 = &vect[0];
  11.  
  12.  
  13. *pvect0 = 42;
  14. cout << "vect[0] = " << vect[0] << endl;
  15.  
  16. cout << endl;
  17. cout << "&vect = " << pvect << endl;
  18. cout << "&vect[0] = " << pvect0 << endl;
  19.  
  20. cout << endl;
  21. cout << "sizeof(vect) = " << sizeof(vect) << endl;
  22. cout << "sizeof(int) * vect.size() = " << sizeof(int) * vect.size() << endl;
  23.  
  24.  
  25.  
  26.  
  27. return 0;
  28. }
Success #stdin #stdout 0s 4488KB
stdin
Standard input is empty
stdout
vect[0] = 42

&vect    = 0x7ffc9d7aa3c0
&vect[0] = 0x5624574c0c20

sizeof(vect)              = 24
sizeof(int) * vect.size() = 40