vector — dynamic size. array — fixed size.
std::vector:
1std::vector<int> v = {1, 2, 3};2v.push_back(4); // OK3v.resize(10); // OK
std::array (C++11):
1std::array<int, 3> arr = {1, 2, 3};2// arr.push_back(4); // Error!3arr[0] = 10; // OK
When to use:
Size:
1std::array<int, 5> arr;2constexpr size_t size = arr.size(); // Compile-time