lang • type • pointer

Pointer

DIM Var AS Pointer

This native datatype represents a pointer, i.e. an address in memory.

In Gambas 3, Pointer is a true datatype, and you cannot replace them with integer numbers.

Example

This example puts the (hex) representation of a Single number into the variable "f". See Single Precision

Dim i As Integer ' 4 bytes
Dim f As Single  ' 4 bytes
Dim p As Pointer
Dim hFile As File

i = &H3EAAAAAA& 'IEEE representation of 1/3

p = VarPtr(f)
hFile = Open Memory p For Write
Write #hFile, i As Integer
Close #hFile

Print f
0.3333333

See also