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
Why is c++ awesome?
Why do we need c++?
What is the difference between strcpy() and strncpy()?
What is the difference between an array and a list?
What is the use of typedef?
What do you mean by static variables?
What are the general quetions are in DEna bank manager IT/System interviews?
What is lvalue?
What is class definition in c++ ?
What is static class data?
Does c++ support exception handling?
Can a program run without main in c++?
What information can an exception contain?
What c++ is used for?
What will the line of code below print out and why?