std::vector:
1std::vector<int> v = {1, 2, 3};2v.push_back(4); // grows dynamically
std::array:
1std::array<int, 5> arr = {1, 2, 3, 4, 5};2// arr.size() is constexpr
When to use:
std::array when size is known at compile timestd::vector when size variesstd::array for small, fixed collectionsstd::vector as default container