Are Vectors Dynamic Arrays

Are Vectors Dynamic Arrays

Are vectors just dynamic arrays?

A vector is a dynamic array, whose size can be increased, whereas THE array size can not be changed. Reserve space can be given for vector, whereas for arrays you cannot give reserved space. A vector is a class whereas an array is a datatype.

What is the difference between vectors and dynamic arrays?

Dynamic arrays need to be deallocated explicitly whereas vectors are automatically de-allocated from heap memory as soon as variable goes out of scope.

Marcus Vance
Author

Marcus Vance

Marcus Vance is a cybersecurity auditor and technology writer dedicated to educating the public about online safety, data privacy regulations, enterprise security, and emerging cyber threats.