c++ array vs vector
//arrays have fixed size, but vectors don't
c++ array vs vector
//arrays have fixed size, but vectors don't
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.
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us