Inquiry Intrinsic Function (Generic): Indicates whether an allocatable array is currently allocated.
Syntax
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.
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