The differences between array and vectors in C++ are as follows:
Array can be static or dynamic; Vector is dynamic
Array can be traversed using indexes, vector uses iterators
No reallocation in array
Size of Array is fixed; Size of vector can be changed
Vector can be copied using assignment statement
Vector size is not required when we pass a vector to a function
Vector can be returned from function; Array cannot be returned
Arrays are deallocated explicitly; Vectors are deallocated automatical...
Published on October 16, 2020 03:05