ALLOCATED

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

Syntax

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.

Compatibility

CONSOLE STANDARD GRAPHICS QUICKWIN GRAPHICS WINDOWS DLL LIB

See Also: ALLOCATABLE, ALLOCATE, DEALLOCATE, Arrays, Dynamic Allocation

Examples

  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