All about array STL in c++ for competitive programming( initialization, traversal and methods/functions ) :
array STL Important Points: It is a sequence container that encapsulates fixed size array. Size is needed at compile time. It's rarely used in competitive programming as vector is there which is far more better than array STL. Remember to use the header file #include<array> before using array STL. Advantages of using vector over array: Vector is dynamic in nature so, size automatically increases with insertion of elements. Array is fixed size, once initialized can't be resized but vector can. Reserve space can be given for vector, whereas for arrays you cannot give reserved space. Vectors can store any type of objects, whereas an array can store only homogeneous values. Multiple objects can be stored in vector. Elements can be deleted in vector. Disadvantages of vector over array: Vector occupies more memory. Vector takes more time in accessing elements. Array is more appropriate for storing a fixed no. of elements. Array support efficient random access