set size of two dimensional vector c++ code example
Example 1: resize two dimensional vector c++
//vector<vector<int>> M;
//int m = number of rows, n = number of columns;
M.resize(m, vector<int>(n));
Example 2: initialise 2d vector in c++
// Initializing 2D vector "vect" with
// values
vector<vector<int> > vect{ { 1, 2, 3 },
{ 4, 5, 6 },
{ 7, 8, 9 } };