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
What is the c++ programming language used for?
how to access grid view row?
List down the guideline that should be followed while using friend function.
Can constructor be static in c++?
What is a float in c++?
How would you use the functions memcpy(), memset(), memmove()?
What is the use of lambda in c++?
What are the defining traits of an object-oriented language?
What are c++ variables?
How many ways can a variable be initialized into in C++?
What is the difference between a baller and a reference in C++?
Explain all the C++ concepts using examples.
What is jump statement in C++?
Can java be faster than c++?
Can a Structure contain a Pointer to itself?