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

Is atoi safe?

596


What is the use of this pointer in c++?

569


What is #include math h in c++?

572


You want to link a c++ program to c functions. How would you do it?

539


How are the features of c++ different from c?

594






Explain the difference between class and struct in c++?

590


What are the two types of comments?

572


What are c++ storage classes?

618


Define a constructor?

589


Which is most difficult programming language?

580


What is #include iostream in c++?

589


What is the difference between strcpy() and strncpy()?

610


Is swift faster than c++?

564


What is buffer and example?

523


Can I have a reference as a data member of a class? If yes, then how do I initialise it?

704