Array is a data structure consisting of a collection of elements (values or variables), each identified by at least one array index or key. An array is stored so that the position of each element can be computed from its index tuple by a mathematical formula. The simplest type of data structure is a linear array, also called one-dimensional array. We can also define a array as a container object which holds a fixed number of values of a single data type.
Arrays are among the oldest and most important data structures, and are used by almost every program. They are also used to implement many other data structures, such as lists and strings. They effectively exploit the addressing logic of computers. In most modern computers and many external storage devices, the memory is a one-dimensional array of words, whose indices are their addresses. Processors, especially vector processors, are often optimized for array operations.
Arrays are useful mostly because the element indices can be computed at run time. Among other things, this feature allows a single iterative statement to process arbitrarily many elements of an array. For that reason, the elements of an array data structure are required to have the same size and should use the same data representation.
The following are also the definitions of array in the area other than computer programming:
- In general, an array is a number of items arranged in some specified way – for example, in a list or in a three-dimensional table.
- In random access memory (RAM), an array is the arrangement of memory cells.
- In data storage, an array (disk array) is a method for storing information on multiple devices. A disk array is a hardware element that contains a large group of hard disk drives (HDDs).