next up previous contents
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_inline21746  type  tex2html_wrap_inline21748  [, tex2html_wrap_inline21746  attribute-list  tex2html_wrap_inline21748 ] [:: ] 
 tex2html_wrap_inline21746  variable-list  tex2html_wrap_inline21748  [ = tex2html_wrap_inline21746  value  tex2html_wrap_inline21748  ]

If tex2html_wrap_inline21746  attribute-list tex2html_wrap_inline21748 or = tex2html_wrap_inline21746  value tex2html_wrap_inline21748 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_inline21898 array, this can be overridden as with z which is declared as a 1D array with 10 elements.

tex2html_wrap_inline21746  attribute-list tex2html_wrap_inline21748 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 contents
Next: Character Declarations Up: Data Objects Previous: Implicit Typing

Adam Marshall ©University of Liverpool, 1996
Fri Dec 6 15:03:35 GMT 1996
Not for commercial use.