FutureBasic Logo

<<    Index    >> FutureBasic

varptr   function

address = varptr( { var | fn userFunction } )
address = @var

varptr(var) returns the memory address where the first byte of the variable var is located. You can use this value as a "pointer" to var. If var is a local variable inside a local function, the value returned by varptr(var) may be different each time you execute the function, and is not valid after the function exits. The syntax @var is just a shorthand version of varptr(var).
varptr( fn userFunction ) is identical to the @fn userFunction function.

Because the "@" symbol has a special meaning when it appears after the print or lprint keyword, you cannot use the @var syntax as the first item in a list of print items.
print @myVar // This does not work ("@" is misinterpreted)
print (@myVar) // This works
print varptr(myVar) // So does this

See also
@fn; dim; print; lprint; peek; poke; BlockMove