remove all element of vector c++
#include <vector>
#include <algorithm>
int main() {
std::vector<int> vec = {1, 2, 3, 4, 5};
vec.clear();
// The clear() function removes all the elements from the vector.
return 0;
}
#include <vector>
#include <algorithm>
int main() {
std::vector<int> vec = {1, 2, 3, 4, 5};
vec.clear();
// The clear() function removes all the elements from the vector.
return 0;
}