The INTEGER statement specifies the type to be integer for a symbolic constant, variable, array, function, or dummy function.
Optionally, it specifies array dimensions and size and initializes with values.
INTEGER [*len[,]] v[* len[/c/]] [, v[*len[/c/]] ...
Parameter |
Description |
v |
Name of a symbolic constant, variable, array, array declarator, function, or dummy function |
len |
Either 2, 4, or 8, the length in bytes of the symbolic constant, variable, array element, or function. |
c |
List of constants for the immediately preceding name |
The declarations can be: INTEGER, INTEGER*2, INTEGER*4, INTEGER*8.
For a declaration such as INTEGER H, the variable H is usually one INTEGER*4 element in memory, interpreted as a single integer number. Specifying the size is nonstandard. @
If you do not specify the size, a default size is used. The default size, for a declaration such as INTEGER H, can be altered by compiling with any of the options -dbl, -i2, -r8, or -xtypemap. See the discussion in Chapter 2 for details.
For a declaration such as INTEGER*2 H, the variable H is always an INTEGER*2 element in memory, interpreted as a single integer number.
For a declaration such as INTEGER*4 H, the variable H is always an INTEGER*4 element in memory, interpreted as a single integer number.
For a declaration such as INTEGER*8 H, the variable H is always an INTEGER*8 element in memory, interpreted as a single integer number.
Do not use INTEGER*8 variables or 8-byte constants or expressions when indexing arrays, otherwise, only 4 low-order bytes are taken into account. This action can cause unpredictable results in your program if the index value exceeds the range for 4-byte integers.
Example 1: Each of these integer declarations are equivalent:
INTEGER U, V(9) INTEGER*4 U, V(9) INTEGER U*4, V(9)*4
INTEGER U / 1 /, V / 4 /, W*2 / 1 /, X*2 / 4 /