Next: , Previous: ALL, Up: Intrinsic Procedures


8.14 ALLOCATED — Status of an allocatable entity

Description:
ALLOCATED(ARRAY) checks the status of whether X is allocated.
Standard:
Fortran 95 and later
Class:
Inquiry function
Syntax:
RESULT = ALLOCATED(ARRAY)
Arguments:

ARRAY The argument shall be an ALLOCATABLE array.

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