Pointer Variables

Prev Next Home Home Table Of Contents Index

POINTER VARIABLES

In MarxMenu, variables can point to other variables allowing parameters to be passed to procedures by reference as well as by value. A pointer variable stores the location of another variable. Any time a pointer variable is accessed, MarxMenu acts upon the variable that the pointer variable is pointing to. Pointer variables are set using the Loc (location) command.


Example:
Var A B C A = Loc B

MarxMenu supports complex location pointers and pointers to other pointers. MarxMenu will resolve all references until real data is found.


Example:
B = Loc A C = Loc B C[5] = 20 Writeln A[5] ;returns 20

Pointers can also be passed as parameters to procedures. Thus if A is an array of strings we can sort A as follows:


 Procedure SortTest (TestArray)
    SortArray(TestArray)
 EndProc

SortTest (Loc A) ;sorts array A

Prev Next Home Home Table Of Contents Index

Sponsors
Shopping
Forum
Forum
email
EMail
Index
Index
Home
Home