Answers for "declare a vector with intial elements as 0"

C++
2

initialize all elements of vector to 0 c++

vector<int> vect1(10); //number of elements in vector
    int value = 0;
    fill(vect1.begin(), vect1.end(), value);
Posted by: Guest on May-19-2021
3

initialize all elements of vector to 0 c++

// Create a vector of size n with
    // all values as 10.
    vector<int> vect(n, 10);
Posted by: Guest on July-17-2021

Code answers related to "declare a vector with intial elements as 0"

Browse Popular Code Answers by Language