Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

resize 2d vector c++

 myVector.resize(row_count, vector<int>(column_count, initialization_value));
//Example1: create a 2D integer vector with 5 rows and 5 columns having "1"
 myVector.resize(5, vector<int>(5, 1));
//Ex2
 myVector.resize(n);
 for (int i = 0; i < n; ++i)
     myVector[i].resize(m);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #resize #vector
ADD COMMENT
Topic
Name
3+4 =