An array is a data structure that is similar to the library vector
type (§ 3.3, p. 96) but offers a different trade-off between performance and flexibility. Like a vector
, an array is a container of unnamed objects of a single type that we access by position. Unlike a vector
, arrays have fixed size; we cannot add elements to an array. Because arrays have fixed size, they sometimes offer better run-time performance for specialized applications. However, that run-time advantage comes at the cost of lost flexibility.