Answers for "how to initialize all the elements of an vector with zeros in cpp"

C++
7

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
3

c++ initialize array with all zeros

int myArray[10] = { 0 }; // all elements 0
Posted by: Guest on January-08-2021

Code answers related to "how to initialize all the elements of an vector with zeros in cpp"

Browse Popular Code Answers by Language