Search⌘ K
AI Features

Types of Array

Explore how arrays are classified by size into static and dynamic types, and by dimensions including one-dimensional, two-dimensional, and multidimensional arrays. Understand their memory allocation, indexing, and practical applications like grids and scientific data representation.

In the previous lesson, we learned what arrays are, how they are indexed, and how they are stored in memory. In this lesson, we will look at how arrays are classified, both by their size and by their dimensions.

Classification of arrays

Arrays can be classified in two ways:

  • By their size

  • By their dimensions

Classification by size

Based on their size, arrays can be classified into two types: static and dynamic. Each differs in how memory is allocated and how much flexibility the array offers. Let’s look at each one in turn.

Static arrays

A static array has a fixed size that is set at the time it is created. The number of elements is fixed at initialization and does not change during program execution.

A static array of size 10
A static array of size 10

Think of it like a printed scorecard with exactly ten rows. If we bowl an eleventh game, there is no room to record it. We would have to start a new, larger scorecard entirely if we want to keep a ...