ALLOCATED

Inquiry Intrinsic Function (Generic): Indicates whether an allocatable array is currently allocated.

Syntax

result = ALLOCATED (array)

array

(Input) Must be an allocatable array.

Results

The result is a scalar of type default logical.

The result has the value true if array is currently allocated, false if array is not currently allocated, or undefined if its allocation status is undefined.

Example

REAL, ALLOCATABLE :: A(:)

...

IF (.NOT. ALLOCATED(A)) ALLOCATE (A (5))

Consider the following:

REAL, ALLOCATABLE, DIMENSION (:,:,:) :: E

PRINT *, ALLOCATED (E) ! Returns the value false

ALLOCATE (E (12, 15, 20))

PRINT *, ALLOCATED (E) ! Returns the value true

See Also