What is the Difference between "vector" and "array"?
Answer Posted / mms zubeir
First, a vector is a template class but not the array is.
So obviously there are members to access the elements of
the vector like, range checking, iterators,
insertion/deletion, predicates, etc.
Since it is a template class, the same implementation can
be used for any type including pointers, objects/user
defined types.
Second, as said by others, vector automatically grow as we
invoke push_back(), we can reserve additional space for
elements, etc.
Is This Answer Correct ? | 18 Yes | 12 No |
Post New Answer View All Answers
Explain the difference between new() and malloc() in c++?
What is the purpose of template?
What is the difference between a baller and a reference in C++?
How do you generate a random number in c++?
Give 10 points of differences between C & C++.
What is c++ iterator?
What is iomanip c++?
What kind of problems can be solved by a namespace?
What is a container class? What are the types of container classes in c++?
What are references in c++? What is a local reference?
Explain linear search.
How are Structure passing and returning implemented by the compiler?
What is class syntax c++?
Mention the ways in which parameterized can be invoked.
What is the difference between an external iterator and an internal iterator? Describe an advantage of the external iterator.