2-d array in c++
vector< vector<int> > vI2Matrix(3, vector<int>(2,0));
I know it declares size of two dimensional array and initializes it. But waht does (2,0 ) means? is there any necessary to put it here? thanks
开发者_JAVA百科When I delete (2,0) or change it to other value. The compilation is right but I got runtime segmentation fault after that.
The vector<int>(2,0)
initializes the vector with two elements with the value of 0.
精彩评论