Check out example codes for "how to initialize vector in c++ with all elements 0". It will help you in understanding the concepts better.

Code Example 1

#include <bits/stdc++.h> 
#include <vector> 
using namespace std; 
  
int main() 
{ 
// This vector initializes with the values: 10, 20, and 30
  vector<int> vect{ 10, 20, 30 }; 

    return 0; 
}

Code Example 2

vector<int> arr(10,0);

Code Example 3

std::vector<type> name;

Learn ReactJs, React Native from akashmittal.com