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 register storage specifier.
Can constructor be static in c++?
Is swift faster than go?
What are stacks? Give an example where they are useful.
Differentiate between an inspector and a mutator ?
Write a note about the virtual member function?
Is oops and c++ same?
What is scope operator in c++?
Explain the extern storage classes in c++.
What do you mean by inheritance in c++? Explain its types.
Specify some guidelines that should be followed while overloading operators?
Can a program run without main?
What is fflush c++?
What is an object in c++?
How a pointer differs from a reference?