Could anyone explain me about vectors used in c++?
They are like arrays, but you can dynamically add items to them using push_back. They also have a function size() to get the length of the vector. I find them amazingly useful!
Vectors are a more "robust" version of standard arrays used in C++.
vector <data-type> anyName(anySize, initial value);
.at(index) Where index is the index of the vector array
.size() The number of elements of the array
.front() The first element value
.back() The last element value
.pop_back() Removes the last element of the vector array
.push_back(any_value) Add a value to the last element
.empty() Indicates if the vector array is empty (boolean)
.clear() Clears the entire vector array