Next: , Previous: ALL, Up: Intrinsic Procedures


6.14 ALLOCATED — Status of an allocatable entity

Description:
ALLOCATED(X) checks the status of whether X is allocated.
Standard:
F95 and later
Class:
Inquiry function
Syntax:
RESULT = 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 .FALSE.
Example:
          program test_allocated
            integer :: i = 4
            real(4), allocatable :: x(:)
            if (allocated(x) .eqv. .false.) allocate(x(i))
          end program test_allocated