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 are static variables?
Write a program using shift_half( ) function to shift the elements of first half array to second half and vice versa.
What is the main purpose of c++?
Is c++ the hardest programming language?
What is auto used for in c++?
What are c++ storage classes?
Is it possible to use a new for the reallocation of pointers ?
What is class and structure in c++?
Is c++ double?
What is a .lib file in c++?
What is conditions when using boolean operators?
What is cout flush?
Can malloc be used in c++?
Explain virtual destructor?
Is rust better than c++?