+ 1

Erase a vector index

how do i erase the last index of the vector? https://code.sololearn.com/cSigrAsP7GLj/?ref=app

30th Aug 2019, 7:49 AM
Cat Sauce
Cat Sauce - avatar
3 Answers
+ 3
vec.pop_back();
30th Aug 2019, 9:59 AM
Kireii
Kireii - avatar
+ 1
30th Aug 2019, 7:55 AM
Elva
Elva - avatar
0
Try this vec.erase(vec.end() - 1); * Vector erase() method: http://www.cplusplus.com/reference/vector/vector/erase/
30th Aug 2019, 8:18 AM
Ipang