c++ how to return an empty vector
#include <iostream>
#include <vector>
std::vector<int> getEmptyVector() {
std::vector<int> emptyVec; // Declaring an empty vector of type int
return emptyVec; // Returning the empty vector
}
int main() {
std::vector<int> result = getEmptyVector(); // Calling the function to get an empty vector
std::cout << "Size of the empty vector: " << result.size() << std::endl; // Printing the size of the empty vector
return 0;
}