ALLOCATED(X)

Purpose

Indicates whether or not an allocatable object is currently allocated.

Class

Inquiry function

Argument type and attributes

X can be one of the following:

ARRAY
is an allocatable array whose allocation status you want to know.
SCALAR
is an allocatable scalar whose allocation status you want to know.

Result type and attributes

Default logical scalar.

Result value

The result corresponds to the allocation status of ARRAY or SCALAR: .TRUE. if it is currently allocated, .FALSE. if it is not currently allocated, or undefined if its allocation status is undefined. If you are compiling with the -qxlf90=autodealloc compiler option there is no undefined allocation status.

Examples

INTEGER, ALLOCATABLE, DIMENSION(:) :: A
PRINT *, ALLOCATED(A)      ! A is not allocated yet.
ALLOCATE (A(1000))
PRINT *, ALLOCATED(A)      ! A is now allocated.
END

Related information

Allocatable arrays, ALLOCATE, Allocation status.