C++ std::array Checking size of the Array


Example

One of the main advantage of std::array as compared to C style array is that we can check the size of the array using size() member function

int main() {
    std::array<int, 3> arr = { 1, 2, 3 };
    cout << arr.size() << endl;
}