FORTRAN Reference Manual

Language Elements
FORTRAN Reference Manual528615-001
2-10
Data Storage—Standard Conformance
the LOGICAL type declaration refers to the prevailing logical type as determined by the
LOGICAL*4 compiler directive. In the absence of such a directive, LOGICAL means
LOGICAL*2.
The general form of a type declaration statement is:
type
is a declaration statement name such as INTEGER*2 or COMPLEX
var-name
is the symbolic name of a constant, variable, array, RECORD field or function
For example, the following statement declares a double precision variable called
INVENTORY:
DOUBLE PRECISION inventory
You can use an IMPLICIT statement to change the default type associated with the
letters of the alphabet. For example, the following statement reverses the default type
setting:
IMPLICIT REAL (i-n), INTEGER (a-h, o-z)
Data Storage—Standard Conformance
The ANSI standard requires that integer, real, and logical variables occupy the same
amount of storage space. To write a program that conforms to the standard, begin the
program with INTEGER*4 and LOGICAL*4 directives, and avoid using the INTEGER*n
form to declare variables and other symbolic names. For example:
PROGRAM main
?INTEGER*4, LOGICAL*4
INTEGER patient number <-- Declares INTEGER*4 variable
LOGICAL discharged <-- Declares LOGICAL*4 variable
.
END
type var-name [, var-name ]...