Imagine you want to store the age of every student in a class. With plain variables, you would write one variable for each student:
age1 = 18
age2 = 19
age3 = 17
This works fine for 3 students. But what about 30 students? Or 300? You would have to create 300 separate variables and remember each name. That quickly becomes impossible to manage. We say it does not scale — meaning it does not stay practical as the amount of data grows.
This is exactly the problem an array is built to solve.
An array is a single container that can hold many values at once. Think of it like a row of small boxes sitting right next to each other, where each box holds one value.
Here are the key ideas:
So an array looks like one long strip:
| value1 | value2 | value3 | value4 | value5 | value6 | value7 |
The total length of this strip — how many boxes it has — is called its size.
Now go back to the class of students. Instead of one variable per student, we create one array that holds all the ages together:
| age1 | age2 | age3 | age4 | age5 | age6 | age7 |
One array, one name, and all the ages live inside it. Whether the class has 7 students or 700, we still use a single array. That is the big win: arrays let us handle large amounts of related data without inventing a new variable for every single item.
An array is a fixed-size, same-type, side-by-side collection of values stored as one unit. It replaces a messy pile of separate variables with one clean, organized container — which is why it is one of the most basic and important building blocks in programming.