FutureBasic Logo

<<    Index    >> FutureBasic 5

xref@   statement



Syntax:
xref@ arrayName(maxSub1[,maxSub2 ...]) [as dataType]

Description:
xref@ is identical to the xref statement, except that the link variable is interpreted as a handle, rather than as a pointer. You should use xref@ when you want the contents of a relocatable block to be treated as an array.

Example:
The following declares an array called inclination, allocates a new block with enough room for numElements elements, and associates the inclination array with the contents of the block.

dim as long 
numElements  : numElements = 5  // 5 is arbitrary
xref@ inclination(1)
inclination = fn NewHandle(
numElements * sizeof( long ) )

Note that, because the value of maxSub1 is ignored in the xref@ statement, we can arbitrarily set it to 1. However, when we actually reference the elements of the inclination array, we can specify any subscript value in the range 0 through numElements - 1.

See Also:
dim; xref