HP Fortran Programmer's Reference (September 2007)

Expressions and assignment
Assignment
Chapter 4 99
icnt = icnt + 1 ! integer assignment
circle1 = circle2 ! derived-type assignment
area = pi * circle%radius**2 ! real assignment
pixel(x,y) = boolx .AND. booly ! assigns a logical expression to
! an element of the logical
! array pixel
a(:,1:2) = 0 ! first two columns of a are set to zero
maxtrix1 = maxtrix2 ! each element of maxtrix2 is assigned to
! the corresponding element of maxtrix1
name = initials // surname ! character assignment using the
! concatenation operator
Pointer assignment
Pointer assignment establishes an association between a pointer and a target. Once the
association is established, if the pointer is referenced on the left-hand side of an assignment
statement, it is the target to which the assignment is made. And if the pointer is referenced in
an expression, the target is taken as the operand in the expression.
The syntax of a pointer assignment is:
pointer-object
=>
target-expression
pointer-object
is a variable with the POINTER attribute.
target-expression
is one of the following:
A variable with the TARGET or POINTER attribute
A function reference or defined operation that returns a pointer result
The type, kind, and rank of
pointer-object
and
target-expression
must be the same. If
target-expression
is an array, it cannot be an assumed-size array or an array section with a
vector subscript. For information about assumed-size arrays, see “Assumed-size arrays” on
page 65. For information about array sections with vector subscripts, see “Vector subscripts”
on page 70.