c++ make empty vector code example
Example 1: c++ initialize a vector
#include <bits/stdc++.h>
#include <vector>
using namespace std;
int main()
{
// This vector initializes with the values: 10, 20, and 30
vector<int> vect{ 10, 20, 30 };
return 0;
}
Example 2: declare vector of size n in c++
#include <vector>
auto n = 20
// create a vector with n=20 integer elements
std::vector<int> arr(n);