Confusion in syntax

Is vectorvec(5) and vector[5] both means that the size of the vector is 5 or not. If not please explain the difference.

hi @nikhil015

  1. vector<int> vec(5) will make a vector of size 5
  2. vector<int> vec[5] will make an array of vectors, the size of array will be 5, the size of each vector of that array will be 0.

thanks, @Ishitagambhir for clearing my doubt.

@nikhil015 dont forget to mark it as resolved! :slight_smile: