AddressOf

See Also: Memory Management Functions, LongPtr, ULongPtr, 64 bit Data Types

Purpose

The AddressOf function returns a pointer to an argument.

Return Type

Pointer

Syntax

AddressOf( {var} )

Where:

Example

Procedure TestAddressOf

    Integer i iVal

    Pointer pAddressOfI

 

    Move 50 to i

    Showln "i = " (string(i)) // This will show i = 50

    Move (AddressOf(i)) to pAddressOfI

    // Store 100 in i using the pointer pAddressOfI

    Move (StoreDW(pAddressOfI, 0, 100)) to iVal

    Showln "i = " (string(i) // Shows i = 100

End_Procedure

Important: When obtaining a pointer to a local variable you must first initialize the variable by assigning it a value. If you do not do this, the pointer returned will not be valid. In the above, example the "Move 50 to I" properly initialized the variable.