Intel® Fortran Compiler 17.0 Developer Guide and Reference

Integer Data Types

Integer data types can be specified as follows:

INTEGER

INTEGER([KIND=]n)

INTEGER*n

n

Is an initialization expression that evaluates to kind 1, 2, 4, or 8.

If a kind parameter is specified, the integer has the kind specified. If a kind parameter is not specified, integer constants are interpreted as follows:

Default integer is affected by compiler option integer-size, the INTEGER compiler directive, and the OPTIONS statement.

The intrinsic inquiry function KIND returns the kind type parameter, if you do not know it. You can use the intrinsic function SELECTED_INT_KIND to find the kind values that provide a given range of integer values. The decimal exponent range is returned by the intrinsic function RANGE.

Examples

The following examples show ways an integer variable can be declared.

An entity-oriented example is:

 INTEGER, DIMENSION(:), POINTER :: days, hours
 INTEGER(2), POINTER :: k, limit
 INTEGER(1), DIMENSION(10) :: min

An attribute-oriented example is:

 INTEGER days, hours
 INTEGER(2) k, limit
 INTEGER(1) min
 DIMENSION days(:), hours(:), min (10)
 POINTER days, hours, k, limit

An integer can be used in certain cases when a logical value is expected, such as in a logical expression evaluating a condition, as in the following:

 INTEGER I, X
 READ (*,*) I
 IF (I) THEN
   X = 1
 END IF

See Also