Answers for "initialize vector to all zeros c++"

C++
4

initialize vector to all zeros c++

// my linkedin : https://www.linkedin.com/in/vaalarivan-prasanna-3a07bb203/
// 1-D case
vector<int> vec(desiredVectorSize, 0);  

// 2-D case
vector<vector<int>> vec(desiredNoOfRows, vector<int>(desiredNoOfColumns, 0));
Posted by: Guest on April-21-2021

Code answers related to "initialize vector to all zeros c++"

Browse Popular Code Answers by Language