What is the Difference between "vector" and "array"?

Answer Posted / namitha

Vectors are a kind of sequence containers. As such, their
elements are ordered following a strict linear sequence.

Vector containers are implemented as dynamic arrays; Just as
regular arrays, vector containers have their elements stored
in contiguous storage locations, which means that their
elements can be accessed not only using iterators but also
using offsets on regular pointers to elements.


Arrays is a sequence of similar data type.

Is This Answer Correct ?    11 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do you initialize a string in c++?

736


Explain deep copy?

794


What is an adaptor class in c++?

783


Is multimap sorted c++?

742


What are the different types of polymorphism in c++?

823


How do you decide which integer type to use?

760


Const char *p , char const *p What is the difference between the above two?

914


How would you obtain segment and offset addresses from a far address of a memory location?

821


If a base class is an adt, and it has three pure virtual functions, how many of these functions must be overridden in its derived classes?

797


What is the most useful programming language?

809


Is c the same as c++?

752


Define pure virtual function?

739


Explain one-definition rule (odr).

859


What are compilers in c++?

830


How do you flush std cout?

815