Transformational Intrinsic Function (Generic): Initializes a pointer as disassociated when it is declared. This is a new intrinsic function in Fortran 95.
Syntax
result = NULL ([ mold ])
mold
(Optional) Must be a pointer; it can be of any type. Its pointer association status can be associated, disassociated, or undefined. If its status is associated, the target does not have to be defined with a value.
Results
The result type is the same as mold, if present; otherwise, it is determined as follows:
If NULL ( ) Appears... | Type is Determined From... |
---|---|
On the right side of pointer assignment | The pointer on the left side |
As initialization for an object in a declaration | The object |
As default initialization for a component | The component |
In a structure constructor | The corresponding component |
As an actual argument | The corresponding dummy argument |
In a DATA statement | The corresponding pointer object |
The result is a pointer with disassociated association status.
If you use module IFWIN or IFWINTY, you will have a name conflict if you use the NULL intrinsic. To avoid this problem, rename the integer parameter constant NULL to something else; for example:
USE IFWIN, NULL0 => NULL
This example lets you use both NULL0 and NULL( ) in the same program unit with no conflict.
Examples
Consider the following:
INTEGER, POINTER :: POINT1 => NULL( )
This statement defines the initial association status of POINT1 to be disassociated.