Different ways to initialize a vector in C++ STL

Vectors in C++ STL are same as the array in C++. The basic difference between a vector and an array is vectors are dynamic arrays with the facility to resize itself whenever a new element is pushed inside the vector or deleted from a vector unlike arrays which have predefined lengths.


This is a companion discussion topic for the original entry at http://iq.opengenus.org/initialize-a-vector-in-cpp-stl/