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
How would you call C functions from C++ and vice versa?
Can we distribute function templates and class templates in object libraries?
Write about an iterator class?
What is a constant? Explain with an example.
What is a .h file c++?
Explain polymorphism?
Explain rtti.
Is swift a good first language?
What are shallow and deep copies?
What is pointer in c++ with example?
What is the full name of logo?
How can a called function determine the number of arguments that have been passed to it?
What are guid?
What are vtable and vptr?
Do you know what are static and dynamic type checking?