Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

ID 767251
Date 3/22/2024
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

ALLOCATED

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

result = ALLOCATED ([ARRAY=]array)

result = ALLOCATED ([SCALAR=]scalar)

array

(Input) Must be an allocatable array.

scalar

(Input) Must be an allocatable scalar.

Results

The result is a scalar of type default logical.

The result has the value true if argument array or scalar is currently allocated; it has the value false if the argument is not currently allocated.

NOTE:

When the argument keyword ARRAY is used, array must be an allocatable array. When the argument keyword SCALAR is used, scalar must be an allocatable scalar.

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