C/C++ Arena

Step 2 of 7

std::array

std::array<T, N> is a fixed-size array with the size in its type (you built one in the templates module). Compared with a C array it:

Use it whenever the size is fixed and known at compile time.

Your turn: write std::array<int, 3> podium(const std::vector<int>& scores) returning the three highest scores, highest first. Missing places are 0. Don't modify the input.

Previous: enum class Next: deque, the double-ended queue