Next: , Previous: ALL, Up: Intrinsic Procedures


8.12 ALLOCATED — Status of an allocatable entity

Description:
ALLOCATED(X) checks the status of whether X is allocated.
Option:
f95, gnu
Class:
inquiry function
Syntax:
L = ALLOCATED(X)
Arguments:

X The argument shall be an ALLOCATABLE array.

Return value:
The return value is a scalar LOGICAL with the default logical kind type parameter. If X is allocated, ALLOCATED(X) is .TRUE.; otherwise, it returns the .TRUE.
Example:
          program test_allocated
            integer :: i = 4
            real(4), allocatable :: x(:)
            if (allocated(x) .eqv. .false.) allocate(x(i)
          end program test_allocated