A variable declaration type modifier

dim symbolname as DataType {Pointer | Ptr}

Declares a pointer variable.

Operator @ (Address of) operator or Varptr are used to take the address of a variable. The Operator * (Value of) operator is used to dereference the pointer, that is, access the actual value stored in the memory location the pointer is pointing at.

' Create the pointer.
Dim p As Integer Ptr

' Create an integer value that we will point to using pointer "p"
Dim num As Integer = 98845

' Point p towards the memory address that variable "num" occupies.
p = @num

' Print the value stored in memory pointed to by pointer "p"
Print "Pointer 'p' ="; *p

' Print the actual location in memory that pointer "p" points at.
Print "Pointer 'p' points to memory location:"
Print p

Dim p As ZString Pointer
Dim text As String
text = "Hello World!"
p = StrPtr(text) + 6
Print text
Print *p

'' Output:
'' Hello World!
'' World!

Dialect Differences:
Differences from QB:
See also:
Back to Standard Data Types
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki

sf.net phatcode