开发者

2-d array in c++

开发者 https://www.devze.com 2023-02-18 16:48 出处:网络
vector< vector<int> > vI2Matrix(3, vector<int>(2,0)); I know itdeclares size of two dimensional array and initializes it. But waht does (2,0 ) means?
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

精彩评论

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