[UP]


Manual Reference Pages  - allocated (3)

NAME

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

CONTENTS

Syntax
Description
Arguments
Return Value
Example
Standard
Class
See Also

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
      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]]


allocated (3) March 18, 2019
Generated by manServer 1.08 from 14663a58-7e3e-4ae8-9c5e-bfe85f606bf1 using man macros.