Sunday 15 August 2010

c++ - How to initialize an array of vector? -



c++ - How to initialize an array of vector? -

i know how initialize vector having default value "val".

vector <int> v(size,val);

but want initialize an array of vector each vector having default value "val".....or if possible different values.

declaration:

vector <int> v[10];

i got it.... there way,too. create two-dimensional vector of given size default value "val":

int n, n; // ... vector< vector<int> > matrix(n, vector<int>(m, val));

c++ vector

No comments:

Post a Comment