How to remove element from array class

2996 views c++
8

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?


EDIT
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

7

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?

JD

Please login first before posting an answer.