AlgoMaster Logo

std::array

Last Updated: May 22, 2026

Medium Priority
10 min read

std::array<T, N> is a fixed-size container added in C++11 that wraps a C-style array of N elements of type T and gives it a normal STL interface (begin, end, size, at, and so on). The size is part of the type, the storage lives on the stack (or wherever the array variable lives, with no heap allocation of its own), and there's no decay-to-pointer pitfall that comes with raw C arrays. This chapter covers what std::array is, how to declare and initialise it, the operations it exposes, structured bindings, comparisons with C arrays and std::vector, and when to use it.

Premium Content

Subscribe to unlock full access to this content and more premium articles.