ALLOCATED(3f) - [FORTRAN:INTRINSIC:ARRAY INQUIRY] Status of an allocatable entity
Syntax
Description
Arguments
Return Value
Example
Standard
Class
See Also
o result = ALLOCATED(ARRAY) o result = ALLOCATED(SCALAR)
ALLOCATED(ARRAY) and ALLOCATED(SCALAR) check the allocation status of ARRAY and SCALAR, respectively.
ARRAY - the argument shall be an ALLOCATABLE array. SCALAR - the argument shall be an ALLOCATABLE scalar.
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..
Sample program:
program demo_allocated integer :: i = 4 real(4), allocatable :: x(:) if (allocated(x) .eqv. .false.) allocate(x(i)) end program demo_allocated
[[Fortran 95]] and later. Note, the scalar= keyword and allocatable scalar entities are available in Fortran 2003 and later.
[[Inquiry function]]
[[move_alloc]]
allocated (3) | March 18, 2019 |