A whole array is referenced by the name of the array. Individual elements or sections of an array are referenced using array subscripts.

## Syntax:

array [(subscript-list)]Where:

arrayis the name of the array.

subscript-listis a comma-separated list of

element-subscriptorsubscript-tripletorvector-subscript

element-subscriptis a scalar INTEGER expression.

subscript-tripletis[element-subscript]:[element-subscript][:stride]

strideis a scalar INTEGER expression.

vector-subscriptis a rank one INTEGER array expression.

The subscripts in* subscript-list* each refer to a dimension
of the array. The left-most subscript refers to the first dimension of the array.

If each subscript in an array subscript list is an element subscript, then the array
reference is to a single *array* *element*.
Otherwise, it is to an *array* *section*
(see See Array Sections).

The elements of an array form a sequence known as array element order. The position of an element of an array in the sequence is:

(1 + (s

_{1}- j_{1})) + ((s_{2}- j_{2}) * d_{1}) + ... ((s_{n}- j_{n}) * d_{n-1}* d_{n-2}... * d_{1})

s

_{i}is the subscript in theith dimension.j

_{i}is the lower bound of theith dimension.d

_{i}is the size of theith dimension.n is the rank of the array.

Another way of describing array element order is that the subscript of the leftmost dimension changes most rapidly as one goes from first element to last in array element order. For example, in the following code

```
````integer, dimension(2,3) :: a`

the order of the elements is *a(1,1)**, *
*a(2,1)**, **a(1,2)*,
*a(2,2)*, *a(1,3)*, *a(2,3)*.
When performing input/output on arrays, array element order is used.

You can refer to a selected portion of an array as an array. Such a portion is called an array section. An array section has a subscript list that contains at least one subscript that is either a subscript triplet or a vector subscript (see the examples under See Subscript Triplets and See Vector Subscripts below). Note that an array section with only one element is not a scalar.

The three components of a subscript triplet are the lower bound of the array section, the upper bound, and the stride (the increment between successive subscripts in the sequence), respectively. Any or all three can be omitted. If the lower bound is omitted, the declared lower bound of the dimension is assumed. If the upper bound is omitted, the upper bound of the dimension is assumed. If the stride is omitted, a stride of one is assumed. Valid examples of array sections using subscript triplets are:

```
````a(2:8:2) ! a(2), a(4), a(6), a(8)`

```
````b(1,3:1:-1) ! b(1,3), b(1,2), b(1,1)`

```
````c(:,:,:) ! c`

A vector (one-dimensional array) subscript can be used to refer to a section of a whole array. Consider the following example:

```
````integer :: vector(3) = (/3,8,12/)`

```
````real :: whole(3,15)`

```
````...`

```
````print*, whole(3,vector)`

Here the array *vector* is used as a subscript of *
whole* in the PRINT statement, which prints the values of elements (3,3),
(3,8), and (3,12).

A CHARACTER array section or array element can have a substring specifier following the subscript list. If a whole array or an array section has a substring specifier, then the reference is an array section. For example,

```
````character (len=10), dimension (10,10) :: my_string`

```
````my_string(3:8,:) (2:4) = 'abc'`

assigns *'abc'* to the array section made up of characters 2
through 4 of rows 3 through 8 of the CHARACTER array *my_string*.