Returns the address of a variable or an array element.
% = V:x
% = VarPtr(x)
x:name of a variable of any type
V: and VarPtr are synonymous and, in the case of strings, return the address of the string itself (not the descriptor address), in the case of arrays they return the address of an array element and in the case of simple variables the address of the variable.
OpenW # 1
Local c%
Dim a(3) As Double
// prints the address of a(3)
Print VarPtr(a(3))
// prints the address of c%
Print VarPtr(c%)
Local b$ = "Test"
Print "Get the string using Char{addr} of b$: "; _
Char{V:b$}
Print "Address of b$: "; V:b$
Print "Descriptor of b$: "; * b$
Print "Length of b$: "; Int{V:b$ - 4}
The descriptor of a string contains the length of the string, is 4 bytes long, and is located right in front of the actual data. The descriptor address is obtained using ArrPtr(a$) or *a$.
{Created by Sjouke Hamstra; Last updated: 04/09/2022 by James Gaite; Other Contributors: Jean-Marie Melanson}