next up previous contents
Next: Characters. Up: Declaration of Variables Previous: Memory Organization. Variables   Contents

Integers.

Declaration:
integer I, J, K  or  
integer :: I, J, K

An integer can be declared and initialized with

integer :: I = 1
Normally, when the program is loaded in memory, the contents of the declared variables are undefined (some compilers may set them to 0 by default). With initialization, the content of the variables when loading is set to the prescribed values.

An integer constant (whose value cannot be changed later in the program) can be declared with

integer MAXIMUM
parameter (MAXIMUM=340)
or with
integer, parameter :: MAXIMUM=340
The plain form of declaration, and the two-statement parameter declaration come from F77, and is legal in F90 also. The double colon ``::'' form is specific to F90. Note that we have to use the double colon form whenever more than one attribute is given for the variable (e.g., when is integer and parameter, i.e. constant) or when the variable is initialized.



Adrian Sandu 2001-08-26