define vector with size c++ code example
Example 1: how to initialize vector in c++ with all elements 0
vector<int> arr(10,0);
Example 2: how to initialize a vector in c++
std::vector<type> name;
Example 3: c++ create vector of size
// create a vector with 20 integer elements
std::vector<int> arr(20);
for(int x = 0; x < 20; ++x)
arr[x] = x;