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
Distinguish between a # include and #define.
What is the two main roles of operating system?
Can the creation of operator** is allowed to perform the to-the-power-of operations?
Give example of a pure virtual function in c++?
Which format specifier is used for printing a pointer value?
What is c++ & why it is used?
Explain stack & heap objects?
What is name hiding in c++?
Explain linear search.
What are the benefits of pointers?
Difference between a copy constructor and an assignment operator.
What are the 3 levels of programming languages?
Which programming language's unsatisfactory performance led to the discovery of c++?
What is the difference between struct and class?
Mention the ways in which parameterized can be invoked. Give an example of each.