vector c++ erase last element code example Example: remove the last element of a vector in cpp vectorname.pop_back();