next up previous
Next: Character Declarations Up: Data Objects Previous: Implicit Typing

 

Numeric and Logical Declarations

 

Variables of a given type should be declared in type declaration statements at the start of a program unit. A simplified syntax follows,

 
 tex2html_wrap_inline21419  type  tex2html_wrap_inline21421  [, tex2html_wrap_inline21419  attribute-list  tex2html_wrap_inline21421 ] [:: ] 
 tex2html_wrap_inline21419  variable-list  tex2html_wrap_inline21421  [ = tex2html_wrap_inline21419  value  tex2html_wrap_inline21421  ]

If tex2html_wrap_inline21419  attribute-list tex2html_wrap_inline21421 or = tex2html_wrap_inline21419  value tex2html_wrap_inline21421 are present then so must be ::.

The following are all valid declarations,

    REAL x
    INTEGER :: i,j
    LOGICAL, POINTER :: ptr
    REAL, DIMENSION(10,10) :: y, z(10)
    DOUBLE PRECISION, DIMENSION(0:9,0:9) :: x

The DIMENSION attribute declares a tex2html_wrap_inline21571 array, this can be overridden as with z which is declared as a 1D array with 10 elements.

tex2html_wrap_inline21419  attribute-list tex2html_wrap_inline21421 represents a list of attributes such as PARAMETER, SAVE, INTENT, POINTER, TARGET, DIMENSION, (for arrays) or visibility attributes. An object may be given more than one attribute per declaration but some cannot be mixed (such as PARAMETER and POINTER).


next up previous
Next: Character Declarations Up: Data Objects Previous: Implicit Typing

Adam Marshall ©University of Liverpool, 1996
Wed Oct 9 17:57:29 BST 1996