An Array is a linear data structure that is easy to implement in all programming languages. It has two prominent properties. First, an array can store only similar data. Second, the elements of an array can be stored only in contiguous memory locations. By similar data type means that if you have created an array to store roll numbers of students you cannot store names in it. Different elements  cannot have different data types.

Array declaration and storage is possible in all programming languages. While declaring an array you have to specify the number of elements you want to store in the array. You cannot store more than the declared number of elements in an array. For example if you declare an array of size 10, you can store maximum 10 elements. Of course, you can store lesser number of elements than the maximum i.e. 10.

Accessing Array Elements

The elements stored can be accessed by the index or subscript of the elements. The first element has index 0 and the last element has index value 1 less than the size of the array.

Consider this sequence of 10 integer elements stored in contiguous memory locations:array

The first element having value 5 is stored at the location identified by index 0 and the last element 87 is stored at the location identified by index 9 (the size of the array is 10, the index of the last element is 1 less than size i.e. 10-1=9)

Each element is identified by an index ( also called a subscript in some programming languages). The array is usually referred by a name and an element is accessed by using the index of the element in square parenthesis after the array name. In the above example ARRAY[3] is element 10 and ARRAY[7] is element 2. The variable declared as an array contains address of the memory location where the first element is stored.

Array element can be accessed, inserted or removed by specifying its position (number of elements preceding it)