arrey dimension

hi all;
how many dimension this arrey have?
vector<vector<int>> opp[6];
Looks to me like you have an array of six two-dimensional vectors.
vector<vector<int>> opp isn't a 2-dimensional vector; it's a vector of vectors. These can be used as if they are 2D arrays (by using two adjacent []s to access elements) if the inner vectors are all the same size. But as the sizes of the individual inner vectors can be sized independently and the storage isn't contiguous, opp isn't actually a 2D array (or vector.)

For example:

1
2
3
4
5
vector<vector<int>> opp(4); // round brackets now, so outer vector has four elems
opp[0].resize(256); 
opp[1].resize(7); 
opp[2].resize(13); 
opp[3].resize(3); 


Andy
Topic archived. No new replies allowed.