Types of Array
Explore the classification of arrays by size and dimensions. Understand the differences between static and dynamic arrays and how to index one-dimensional, two-dimensional, and multidimensional arrays. Learn practical applications and Python examples to solidify your understanding of array types and their use.
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.
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 ...