Array pointers

An array with the POINTER attribute is referred to as an array pointer. Its bounds and shape are determined when it is associated with a target through the following ways:
  • Pointer assignment
  • Argument association
  • Execution of an ALLOCATE statement

Example

The following example declares an array pointer and determines its bounds and storage association.

REAL, POINTER, DIMENSION(:, :) :: b
REAL, TARGET, DIMENSION(5, 10) :: c, d(10, 10)
b => c   ! Bounds of b are now defined (1:5, 1:10)
b => d   ! b now has different bounds and is associated with different storage

If you use the following ALLOCATE statement and compile your program with the -qinitalloc option, all elements of the array pointer b are initialized to zero.

ALLOCATE(b(5, 5)) ! Change bounds and storage association again

Related information



Voice your opinion on getting help information Ask IBM compiler experts a technical question in the IBM XL compilers forum Reach out to us