In computer science, an array data structure or simply an 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.

For example, an array of 10 integer variables, with indices 0 through 9, may be stored as 10 words at memory addresses 2000, 2004, 2008, … 2036, so that the element with index i has the address 2000 + 4 × i.

###
__One-dimensional arrays__

A one-dimensional array (or single dimension array) is a type of linear array. Accessing its elements involves a single subscript which can either represent a row or column index.
As an example consider the C declaration `int anArrayName[10];`

Syntax : **datatype** **anArrayname[sizeofArray]**;

For Example, **int Arr[25]; will make an array of type 'int', name 'Arr' and size=25.**

###
__Multidimensional arrays__

For a two-dimensional array, the element with indices *i*,*j* would have address *B* + *c* · *i* + *d* · *j*, where the coefficients *c* and *d* are the *row* and *column address increments*, respectively.

More generally, in a *k*-dimensional array, the address of an element with indices *i*_{1}, *i*_{2}, …, *i*_{k} is

*B* + *c*_{1} · *i*_{1} + *c*_{2} · *i*_{2} + … + *c*_{k} · *i*_{k}.

For example: int a[3][2];

This means that array a has 3 rows and 2 columns, and the array is of integer type. Here we can store 6 elements they are stored linearly but starting from first row linear then continuing with second row. The above array will be stored as a_{11}, a_{12}, a_{13}, a_{21}, a_{22}, a_{23}.

###
__Compact layouts__

Often the coefficients are chosen so that the elements occupy a contiguous area of memory. However, that is not necessary. Even if arrays are always created with contiguous elements, some array slicing operations may create non-contiguous sub-arrays from them.

There are two systematic compact layouts for a two-dimensional array. For example, consider the matrix

In the row-major order layout, the elements in each row are stored in consecutive positions and all of the elements of a row have a lower address than any of the elements of a consecutive row: