ALLOCATED (The GNU Fortran Compiler) (original) (raw)
8.15 ALLOCATED
— Status of an allocatable entity ¶
Synopsis:
RESULT = ALLOCATED(ARRAY) |
---|
RESULT = ALLOCATED(SCALAR) |
Description:
ALLOCATED(ARRAY)
and ALLOCATED(SCALAR)
check the allocation status of ARRAY and SCALAR, respectively.
Class:
Inquiry function
Arguments:
ARRAY | The argument shall be an ALLOCATABLE array. |
---|---|
SCALAR | The argument shall be an ALLOCATABLE scalar. |
Return value:
The return value is a scalar LOGICAL
with the default logical kind type parameter. If the argument is allocated, then the result is.TRUE.
; otherwise, it returns .FALSE.
Example:
program test_allocated integer :: i = 4 real(4), allocatable :: x(:) if (.not. allocated(x)) allocate(x(i)) end program test_allocated
Standard:
Fortran 90 and later; for the SCALAR=
keyword and allocatable scalar entities, Fortran 2003 and later.