how to initialize a vector of length n with certian value code example Example: how to initialize vector in c++ with all elements 0 vector<int> arr(10,0);