[UP]


Manual Reference Pages  - allocated (3)

NAME

allocated(3f) - [FORTRAN:INTRINSIC:ARRAY INQUIRY] Status of an allocatable entity

SYNTAX

o result = ALLOCATED(ARRAY)
o result = ALLOCATED(SCALAR)

DESCRIPTION

ALLOCATED(ARRAY) and ALLOCATED(SCALAR) check the allocation status of ARRAY and SCALAR, respectively.

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

Sample program:

    program demo_allocated
    implicit none
    integer :: i = 4
    real(4), allocatable :: x(:)
       if (allocated(x) .eqv. .false.) allocate(x(i))
    end program demo_allocated

STANDARD

[[Fortran 95]] and later. Note, the scalar= keyword and allocatable scalar entities are available in Fortran 2003 and later.

CLASS

[[Inquiry function]]

SEE ALSO

move_alloc(3)


allocated (3) March 11, 2021
Generated by manServer 1.08 from ba21242b-d351-429c-8d2f-e910abd57240 using man macros.