next up previous contents
Next: Association with Arrays Up: Pointers and Targets Previous: Target Declaration   Contents

Pointer Assignment

Is a form of referring an object by different names - the pointer and its target reffer to the same space in memory. Pointer assignment takes place between a pointer variable and a target variable, or between two pointer variables.

PtoR => y
Pointer PtoR is associated with the target y, i.e. PtoR becomes an alias for y.
PtoA => b
Pointer PtoA is associated with the target b, i.e. PtoA becomes an alias for b.
PtoR2 => PtoR
Pointer PtoR2 is associated with the target of the pointer PtoR, i.e. is associated with y; now both PtoR and PtoR2 are aliases for y. This statement is correct since all pointer variables implicitly have the TARGET attribute (PtoR is here a target).

Note the difference between ``pointer asignment'' (, which makes the pointer and the target variables reference the same space) and ``normal assignment'' (, which alters the value in the space reffered to by the LHS).

For example,

x=3.0  
PtoR => y !  pointer assignment  
PtoR = x  !  y = x
The last statement effectively sets y to 3. Pointers in a ``normal assignment'' are automatically dereferenced; thus, PtoR is effectively an alias for y.


next up previous contents
Next: Association with Arrays Up: Pointers and Targets Previous: Target Declaration   Contents
Adrian Sandu 2001-08-26