ALLOCATED — Status of an allocatable entity#
-
ALLOCATED(ARRAY)#
ALLOCATED(ARRAY)andALLOCATED(SCALAR)check the allocation status ofARRAYandSCALAR, respectively.- Parameters:
ARRAY – The argument shall be an
ALLOCATABLEarray.SCALAR – The argument shall be an
ALLOCATABLEscalar.
- Returns:
The return value is a scalar
LOGICALwith the default logical kind type parameter. If the argument is allocated, then the result is.TRUE.; otherwise, it returns.FALSE.
- Standard:
Fortran 90 and later. Note, the
SCALAR=keyword and allocatable scalar entities are available in Fortran 2003 and later.- Class:
Inquiry function
- Syntax:
RESULT = ALLOCATED(ARRAY) RESULT = ALLOCATED(SCALAR)
- Example:
program test_allocated integer :: i = 4 real(4), allocatable :: x(:) if (.not. allocated(x)) allocate(x(i)) end program test_allocated