vector<int> vec; vec.push_back(0); vec.push_back(1); int last_element = vec.back(); int also_last_element = vec[vec.size() - 1];