02.07.2013 Views

HP Fortran Programmer's Reference

HP Fortran Programmer's Reference

HP Fortran Programmer's Reference

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

icnt = icnt + 1 ! integer assignment<br />

circle1 = circle2 ! derived-type assignment<br />

area = pi * circle%radius**2 ! real assignment<br />

pixel(x,y) = boolx .AND. booly ! assigns a logical expression to<br />

! an element of the logical<br />

! array pixel<br />

a(:,1:2) = 0 ! first two columns of a are set to zero<br />

maxtrix1 = maxtrix2 ! each element of maxtrix2 is assigned to<br />

! the corresponding element of maxtrix1<br />

name = initials // surname ! character assignment using the<br />

! concatenation operator<br />

Pointer assignment<br />

Expressions and assignment<br />

Assignment<br />

Pointer assignment establishes an association between a pointer and a target. Once the<br />

association is established, if the pointer is referenced on the left-hand side of an assignment<br />

statement, it is the target to which the assignment is made. And if the pointer is referenced in<br />

an expression, the target is taken as the operand in the expression.<br />

The syntax of a pointer assignment is:<br />

pointer-object => target-expression<br />

pointer-object<br />

target-expression<br />

is a variable with the POINTER attribute.<br />

is one of the following:<br />

A variable with the TARGET or POINTER attribute<br />

A function reference or defined operation that returns a pointer result<br />

The type, kind, and rank of pointer-object and target-expression must be the same. If<br />

target-expression is an array, it cannot be an assumed-size array or an array section with a<br />

vector subscript. For information about assumed-size arrays, see “Assumed-size arrays” on<br />

page 63. For information about array sections with vector subscripts, see “Vector subscripts”<br />

on page 68.<br />

Chapter 5 97

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!