fork download
  1. #include <iostream>
  2. #include <vector>
  3.  
  4. using namespace std;
  5.  
  6. int main () {
  7.  
  8. vector<int> a(5);
  9.  
  10. auto x = a[1]; // x : int
  11. decltype(a[1]) y = a[1]; // y : int&
  12.  
  13. cout << a[1] << endl;
  14. x = 123;
  15. cout << a[1] << endl;
  16. y = 456;
  17. cout << a[1] << endl;
  18. return 0;
  19. }
Success #stdin #stdout 0s 2960KB
stdin
Standard input is empty
stdout
0
0
456