## DIMENSION attribute

### Standard: (F77) F90 F95 F2003 F2008 Example program

### ＜Syntax＞

*type*, DIMENSION ( *array-spec* ) [ , *attr-spec* ]... :: *decl-list*

DIMENSION [ :: ] *name* ( *array-spec* ) [ , *name* ( *array-spec* ) ]...

array-spec | ::= | assumed-shape |

| | assumed-size | |

| | deferred-shape | |

| | explicit-shape | |

| | implied-shape |

*assumed-shape* ::= *a-bound* [ , *a-bound* ]...

*a-bound* ::= [ *expression* ] :

*assumed-size* ::= [ *e-bound* , ]... *asize-bound*

*asize-bound* ::= [ *expression* : ] *

*explicit-shape* ::= *e-bound* [ , *e-bound* ]...

*e-bound* ::= [ *expression* : ] *expression*

*deferred-shape* ::= *d-bound* [ , *d-bound* ]...

*d-bound* ::= :

*implied-shape* ::= *i-bound* [ , *i-bound* ]...

*i-bound* ::= [ *expression* : ] *

### ＜Semantics＞

The DIMENSION attribute declares arrays.
An *assumed-shape* or *assumed-size* array must be a dummy argument, a *deferred-shape* array must be a pointer or allocatable array, and an *implied-shape* array must be a named constant (the shape is implied by the shape of the defining expression for the constant).
If a lower bound expression is omitted, that lower bound will have the value one.

The maximum rank (number of dimensions) of an array is 7 prior to Fortran 2008, and 15 from Fortran 2008 onwards. Release 6.0 of the NAG Fortran Compiler supports a maximum rank of 31.

The DIMENSION attribute can also be specified by putting an *array-spec* in parentheses after the entity name in a type declaration or component definition statement; this overrides any DIMENSION clause that might be present.

### ＜Related＞

Array assignment, Array constructor, Array section, Component Definition statement, CONTIGUOUS attribute, FORALL construct, FORALL statement, LBOUND intrinsic function, PARAMETER attribute, SHAPE intrinsic function, SIZE intrinsic function, Type Declaration statement, UBOUND intrinsic function, WHERE construct, WHERE statement