Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

how to create 2d array using vector in c++

vector<vector<int>> vec(N, vector<int> (M, INT_MAX));

Explanation::
vector<vector<int>> -- will take the formed container
N -- Think like row of 2d Matrix
vector<int> (M, INT_MAX) -- In each row, there is again a vector associated with it, 
that will formed 2d array.
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #create #array #vector
ADD COMMENT
Topic
Name
8+3 =