lang • type • 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.


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

= &H3EAAAAAA& 'IEEE representation of 1/3

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

Print f

See also