Arrays are fundamental data structures in programming, defined as collections of similar data items stored at contiguous memory locations. They offer efficient means of organizing and accessing data, where each element can be accessed using its index number.
Imagine you have grades for 5 classes. Instead of managing five separate containers, think of an array as a single box with five compartments, each designated for a grade. To locate a particular grade, you simply refer to its assigned code (index always starts from (0) zero) – no exhaustive searching required! Arrays streamline organization and access in computer programs, making tasks significantly more manageable and efficient.
Properties of Array
- Consistent Data Type: All elements in an array are of the same data type and size, typically 4 bytes.
- Contiguous Memory Storage: Array elements are stored in consecutive memory locations, with the first element at the lowest memory address.
- Random Access: You can access any element in the array directly by calculating its address using the base address and the size of each element. This enables efficient and direct retrieval of array elements.
Representation of an array
Arrays can be represented differently in various programming languages. Let's look at how we declare an array in C language.

As per the above illustration, there are some of the following important points
- Index number starts with always 0 (Zero).
- The array's length is 10, which means we can store 10 elements. If we specify the array length as 5, then we can store 5 elements.
- Each element in the array can be accessed via its index number.
Why arrays are used?
- Sorting and searching for a value in an array is simpler.
- Arrays excel at handling multiple values swiftly and conveniently.
- Arrays streamline data storage in programming by enabling multiple values to be stored in a single variable. This simplifies code, reducing the need for numerous variable declarations and making it easier to manage and organize data.
Array - Insertion Operation
Insertion operation refers to the action of adding one or more elements into an array. This operation offers flexibility as elements can be inserted at various positions within the array, including the beginning, end, or any specific index according to specific requirements. For example, if we want to add a new element into our array, we can choose where it goes: maybe at the start, the end, or somewhere in between. It all depends on what we need or where we want to add.



Mariusz PostolPosted Jul 16, 2024, 9:01 AM
More in context of structural data you cn get from my article at-: <https://www.c-sharpcorner.com/article/programming-in-practice-structural-data/>.
Mariusz PostolPosted Jul 16, 2024, 9:01 AM
What diferece is btween comlpex data and structural data.