FORTRAN 77 Language Reference

The Type Statement

The type statement specifies the data type of items in the list, optionally specifies array dimensions, and initializes with values.

type v [/ clist /] [, v [/ clist /]...

Parameter 

Description 

type 

One of the following:

BYTE @

CHARACTER

CHARACTER*n (where n is greater than 0)

CHARACTER*(*)

COMPLEX

COMPLEX*8 @

COMPLEX*16 @

COMPLEX*32 @(SPARC only)

DOUBLE COMPLEX @

INTEGER

INTEGER*2 @

INTEGER*4 @

INTEGER*8 @

LOGICAL

LOGICAL*1 @

LOGICAL*2 @

LOGICAL*4 @

LOGICAL*8 @

REAL

REAL*4 @

REAL*8 @

REAL*16 @(SPARC only)

DOUBLE PRECISION

v

Variable name, array name, array declarator, symbolic name of a constant, statement function or function subprogram name 

clist

List of constants. There are more details about clist in the section on the DATA statement.

type can be preceded by either AUTOMATIC or STATIC.

Description

A type statement can be used to:

A type statement can assign initial values to variables, arrays, or record fields by specifying a list of constants (clist) as in a DATA statement. @

The general form of a type statement is:

type VariableName / constant /

or

type ArrayName / constant, /

or

type ArrayName / r*constant /

Example: Various type statements:


       CHARACTER LABEL*12 / 'Standard' /
       COMPLEX STRESSPT / ( 0.0, 1.0 ) /
       INTEGER COUNT / 99 /, Z / 1 /
       REAL PRICE / 0.0 /, COST / 0.0 /
       REAL LIST(8) / 0.0, 6*1.0, 0.0 /

When you initialize a data type, remember the following restrictions:

Restrictions

A symbolic name can appear only once in type statements in a program unit.

A type statement must precede all executable statements.

Example

Example: The type statement:


       INTEGER*2 I, J/0/ 
       REAL*4 PI/3.141592654/,ARRAY(10)/5*0.0,5*1.0/ 
       CHARACTER*10 NAME 
       CHARACTER*10 TITLE/'Heading'/ 

In the above example: