fork download
  1. #include <iostream>
  2. #include <algorithm>
  3. using namespace std;
  4.  
  5. vector<int> vecInt;
  6. vector<int*> vecPInt;
  7. int main()
  8. {
  9. vecInt.reserve(10);
  10. vecInt.push_back(1);
  11. vecPInt.push_back(&vecInt[0]);
  12. vecInt.push_back(3);
  13. vecPInt.push_back(&vecInt[1]);
  14. for(auto v:vecInt)
  15. {
  16. cout<<v<<"\n";
  17. }
  18. for(auto v:vecPInt)
  19. {
  20. cout<<*v<<"\n";
  21. }
  22. return 0;
  23. }
Success #stdin #stdout 0s 3468KB
stdin
Standard input is empty
stdout
1
3
1
3