# Introduction to Array

An array is a collection of same data type, whose individual elements are arranged in a regular pattern.
Practical description of the arrays.
Example:
A(8)={1,8,3,6,1,4,7,5}
So now we will show you how the array elements are stored in memory
 A(0) A(1) A(2) A(3) A(4) A(5) A(6) A(7) 2 8 3 6 1 4 7 5
First of all we will discuss about some components which always comes in arrays.
These are:
Extent:
The number of elements in each dimension is called extent in that dimension
Rank:
The number of dimensions of an array is called its rank.
Size:
The size of an array is the total number of elements in it.
Shape:
The shape of an array is a vector whose elements are the extent of the array in each of its dimensions.
Why we need array?
· It is easier to declare one variable name instead of tens or even thousands variable name   or Arrays are the only way which can store and manipulate the thousands and thousands   of data of same type.
· Flexible accessing (one can easily operate on various array areas in different ways).
· Easier to understand the code (notational convenience).
· Inherent Data Parallelism (perform a similar computation on many data objects   simultaneously).
· Optimization opportunities (for compiler designers).
· Reduction of program size.
How the Arrays are created?
As we know that variables in Fortran may be integer, real, logical or complex, Array name is defined in the same way.
Let us consider if X is declared as an array name and if it will be real and their elements X1, X2,…..must have real values. Similarly again consider if MATR is an array name, then the array will be integer and its elements will be integers. Arrays of integer, real, logical or complex types may be formed by declaring the types of variables in explicit type declarations.
Array can be understood by the following example:
Let us consider in a class there are 100 students and the marks obtained by the each student in the exam are written on one or more lines. A program is required to print out the highest and the second highest marks obtained in that exam. It is a time taking process when is solved by simple mathematics. With the help of Array it can be solved in very short period.
Program: In this program the statement DIMENSION MARKS (10) is non-executable statement which provides information to the compiler that MARKS is a subscripted variable with 10 components and each component is of type integer since MARKS is an integer variable name.
The DO loop:
DO 10 I = 1, 10 