Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

how to initialize 2d vector in c++

#include<vector>
#include<algorithm>

// all the  std and main syntax ofcourse.

vector<int> pack = {1,2,3} ;

// To add at the END
pack.push_back(6);       // {1,2,3,6}

//  OR
// To add at BEGGINING 
pack.insert(pack.begin(),6) 	// {6,1,2,3,}		
Source by www.techiedelight.com #
 
PREVIOUS NEXT
Tagged: #initialize #vector
ADD COMMENT
Topic
Name
6+8 =