How to remove element from array class

2996 views c++

i have array declaration

array<int, 5> niz;

Now i need to found maximum in that array and to remove it . How to achieve that with class array?

so array size cant be modified, so can i swift two elements in array then?

answered question

This is impossible. The array size is constant.

1 Answer


It cannot be done. A std::array has a fixed, compile-time determined number of elements. If you want a container that supports a changing number of elements, you can use for example std::vector.

posted this

Have an answer?


Please login first before posting an answer.