# INTEGER Directive

General Compiler Directive: Specifies the default integer kind.

!DIR$ INTEGER:{ 2 | 4 | 8 }

The INTEGER directive specifies a size of 2 (KIND=2), 4 (KIND=4), or 8 (KIND=8) bytes for default integer numbers.

When the INTEGER directive is in effect, all default integer variables are of the kind specified. Only numbers specified or implied as INTEGER without KIND are affected.

The INTEGER directive can only appear at the top of a program unit. A program unit is a main program, an external subroutine or function, a module or a block data program unit. INTEGER cannot appear at the beginning of internal subprograms. It does not affect modules invoked with the USE statement in the program unit that contains it.

The default logical kind is the same as the default integer kind. So, when you change the default integer kind you also change the default logical kind.

## Example

    INTEGER i            ! a 4-byte integer
    WRITE(*,*) KIND(i)
    CALL INTEGER2( )
    WRITE(*,*) KIND(i)   ! still a 4-byte integer
                         !   not affected by setting in subroutine
    END

    SUBROUTINE INTEGER2( )
      !DIR$ INTEGER:2
      INTEGER j          ! a 2-byte integer
      WRITE(*,*) KIND(j)
    END SUBROUTINE

Parent topic: H to I

## See Also

INTEGER
REAL Directive
General Compiler Directives
Syntax Rules for Compiler Directives
Integer Data Types
Integer Constants