Duck Icon

Lander's blog

An array is a data structure that stores elements of the same type sequentially in memory

An array is a data structure that stores elements of the same type sequentially in memory. Arrays are statically allocated, meaning their size is fixed upon creation, and their size needs to be known at compile time. They have the benefit of O(1) random access due to pointer arithmetic being able to directly access elements at any point in the array.

Some downsides of arrays are that the data must all be of the same type, and average case O(n) insertion and deletion.

Links to this note