开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜