Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP Fortran 90 Programmer's Reference: HP Fortran 90 Programmer's Reference > Chapter 10 HP Fortran 90 statements

NULLIFY

» 

Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

 » Glossary

Disassociates a pointer from a target.

Syntax

NULLIFY (pointer-object-list)
pointer-object-list

is a comma-separated list of variable names and derived-type components.

Description

The NULLIFY statement disassociates a pointer from any target. A NULLIFY statement is also used to change the status of a pointer from undefined to disassociated.

Examples

The following example shows the declaration and use of a variable with the pointer attribute:

REAL, TARGET :: value  ! value can be target
REAL, POINTER :: pt ! for the pointer
pt.pt => value ! Associate pt with value
NULLIFY (pt) ! Disassociate pt

! ASSOCIATED intrinsic is valid in next statement if (and only
! if) pt has been previously allocated, assigned (as above), or
! nullified (as above)
IF (.NOT.ASSOCIATED(pt)) pt => x

The next example shows how a derived type can be used in list processing applications:

TYPE list_node
INTEGER value
TYPE (list_node), POINTER :: next
END TYPE list_node
TYPE (list_node), POINTER :: list
ALLOCATE (list) ! Create new list node
list % value = 28 ! Initialize data field
NULLIFY (list % next) ! Nullify pointer to the next node

Related statements

ALLOCATE, DEALLOCATE, POINTER, and TARGET

Related concepts

For information about pointers, see “Pointers”.

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© Hewlett-Packard Development Company, L.P.