ADDRESSOF Operator

A unary operator that returns the address of a variable.

Syntax

result = AddressOf varname

The AddressOf operator syntax has these parts:

Part Description
result Required; any numeric variable.
varname Required; any variable.

Remarks

The AddressOf operator returnns the address of any variable. If the variable was declared as object and wasn't initialized, AddressOf returns 0. If the variable was declared and initialized with the Set statement, AddressOf returns the address of the variable in memory.

Example

Dim MyAddress, AddressOfMyAddress, MyPoint as DPoint
MyAddress = AddressOF MyPoint ' Returns 0.
trace MyAddress

Set MyPoint = New DPoint
MyAddress = AddressOF MyPoint ' Returns address of object MyPoint.
trace Hex(MyAddress)

AddressOfMyAddress = AddressOF MyAddress ' Returns address of variable MyAddress.
trace Hex(AddressOfMyAddress)

 

See Also

Operators