vector in c++ initialization code example
Example 1: initialize 3d vector c++
vector<vector<vector<double>>> f(3, vector<vector<double>>(4, vector<double>(5)));
Example 2: 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 3: how to initialize a vector in c++
std::vector<type> name;