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 difference between the parameter to a template and the parameter to a function?
Why is c++ a mid-level programming language?
What is the C-style character string?
Can you help me with this one? Make a program that when a user inputed a Product Name, it will display its price, and when the user inputed the quantity of the inputed product, it will show its total price. The output must be like this: Product Name: Price: Quantity: Total Price: ..this is the list of products to be inputed: Cellphone - 1500 Washing Machine - 5200 Television - 6000 Refrigirator - 8000 Oven - 2000 Computer - 11000 thanks..:D
What is data binding in c++?
Write a single instruction that will store an EVEN random integer between 54 and 212 inclusive in the variable myran. (NOTE only generate EVEN random numbers)
How the delete operator differs from the delete[]operator?
Which is the best c++ compiler for beginners?
Define a pointer to a data member of the type pointer to pointer?
Is java as fast as c++?
What is a null object in c++?
What do you know about near, far and huge pointer?
Can we specify variable field width in a scanf() format string? If possible how?
What function initalizes variables in a class: a) Destructor b) Constitutor c) Constructor
Explain the purpose of the keyword volatile.