Arrays are everywhere! If you are exploring a new programming language, you will notice that arrays are the first and most important data structure to learn. Arrays are important as they hold multiple values in a single variable.
Imagine you are dealing with hundreds or even thousands of records, and you want to loop through these records to get a specific element. An array makes the job super easy as you don’t have to define hundred or thousands of variables, just one!
Some of the reasons why you must array in your code are below:
Let’s say you are a boss and you have ten employees. You want to create a program to manage your employee’s affairs. Without arrays, you will need to define variables for each employee:
Employee0; Employee1; Employee2; Employee3; Employee4; Employee5; Employee6; Employee7; Employee8; Employee9;
Employee[10];
Arrays are stored in the memory in contiguous locations in the RAM ( random access memory). This means all array elements are stored within a defined memory range.