| United States-English |
|
|
|
![]() |
HP Fortran 90 Programmer's Reference: HP Series 700/800 Computers > Chapter 3 Data types and data objectsDynamic data objects |
|
Allocatable arrays, pointers and automatic objects are allocated dynamically. A variable with the POINTER attribute is referred to as a pointer. It can be in one of three states: undefined, disassociated, or associated. On entry to a program, all pointers are undefined. If variable p is a pointer: The ASSOCIATED intrinsic function inquires if a pointer is associated with:
A pointer can also be associated with an existing target using pointer assignment (see Chapter 5 for details). Briefly, p => t associates pointer p with target t. If t is a pointer then p becomes associated with the target with which t is associated. An automatic object is an explicit-shape array or character string whose size is determined by values which are known only on entry to the procedure in which it is declared. It cannot be a dummy argument and cannot possess the SAVE attribute. Its storage space is dynamically allocated upon invocation of the subprogram and is released on return from the subprogram. Consider the following example:
Array a is dynamically allocated on entry to the subroutine sub, by which time the value of n has been defined. Similarly, character variable c will be dynamically allocated, with length n. The storage for both of these automatic objects will be released on return from the subroutine. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||