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 a pdb file?
What is the difference between prefix and postfix versions of operator++()?
How we can differentiate between a pre and post increment operators during overloading?
Can I learn c++ in a week?
If dog is a friend of boy and boy is a friend of house, is dog a friend of house?
Is java the same as c++?
Why the usage of pointers in C++ is not recommended ?
Is oops and c++ same?
I was a c++ code and was asked to find out the bug in that. The bug was that he declared an object locally in a function and tried to return the pointer to that object. Since the object is local to the function, it no more exists after returning from the function. The pointer, therefore, is invalid outside.
What is pure virtual function?
Is sorted c++?
write a corrected statement so that the instruction will work properly. if (4 < x < 11) y = 2 * x;
What is a singleton class c++?
Is overriding possible in c++?
What is the identity function in c++? How is it useful?