Answers for "how to point to last element in vector?"

C++
19

access last element in vector in c++

vector<int> v;
cout << v[v.size() - 1];
cout << *(v.end() - 1);
cout << *v.rbegin();
// all three of them work
Posted by: Guest on May-31-2020

Code answers related to "how to point to last element in vector?"

Browse Popular Code Answers by Language