Overview
An array is a data structure used to store multiple elements with the same data type. An array is a collection of homogeneous elements.
The elements have similar data types. This means that an array can store either all integers, all floating point numbers, all characters, all strings, or any other complex data type, but all the elements stored in the array should be of the same type.
We can use the array data structure when the number of elements is known. Array elements are always stored in consecutive memory locations.
One-Dimensional Array
A one-dimensional array is one in which only one subscript specification is needed to specify a particular element of the array. A one-dimensional array is a list of array elements of the same data type stored in consecutive memory locations.
Array Operations
The following are the basic operations supported by an array.
Array Operation | Description |
Insertion | Add an array element at the given index |
Deletion | Delete an array element at the given index |
Traverse | Access or print the array elements one by one |
Search | Search an array element using the given index or by the value |
Update | Update an array element at the given index |