Next: AND, Previous: ALL, Up: Intrinsic Procedures
ALLOCATED — Status of an allocatable entityALLOCATED(X) checks the status of whether X is allocated.
RESULT = ALLOCATED(X)
| X | The argument shall be an ALLOCATABLE array.
|
LOGICAL with the default logical
kind type parameter. If X is allocated, ALLOCATED(X)
is .TRUE.; otherwise, it returns the .TRUE.
program test_allocated
integer :: i = 4
real(4), allocatable :: x(:)
if (allocated(x) .eqv. .false.) allocate(x(i))
end program test_allocated