iloveseven
0
Q:

c++ array vs vector

- Array contains similar data type. Vector can store heterogeneous data types,
if restriction is not put using generics concept.
- Array has primitive data type, does not belong to Collection family.
Vector implements List interface which is a part of collection hierarchy.
- Array is static and needs to be assigned with the fixed size during
initialization. Vector resizes itself dynamically as per the need. So, 
it is dynamic in nature.
- Array is non-synchronized. Vector is synchronized.
- Array can be traversed using for loop or enhanced for loop. It cannot use
iterator or enumeration interface. Vector can be traversed using iterator 
or enumeration interface.
1
//arrays have fixed size, but vectors don't
1

New to Communities?

Join the community