References
References are a standard IEC type that act as a pointer to another variable (the referenced variable). Reference type works like the pointer type (see paragraph 11.7.2), but the pointer type is not a standard IEC type and has several less restricion, which make the pointer type more flexible but also more dangerous than the reference type.The value of the reference is the address of the referenced variable; in order to access the data stored at the referenced address, a reference can be dereferenced.Reference declaration requires the same syntax used in variable declaration, where the type name is the type name of the referenced variable with ^ sign after:VAR : ^;END_VARFor example, the declaration of a reference to an INT shall be as follows:VARrInt : INT^;END_VARReference can be assigned with another reference or with an address; the special operator REF is available to retrieve the reference address of a variable.rx := ry; (* where rx and ry are reference of the same type *)rx := REF(x); (* where rx is a reference to the same type of x *)Accessing to the reference variable followed by the ^ sign, will dereference the variable:rx := REF(x); (* rx i a reference to x *)rx^ := 10; (* x vaule is now 10 *)rx^ := rx^ + 1;(* x value now is 11 *)y := rx^; (* y value now is 11, y is of the same type of x *)For further information about references, please refer to IEC standard reference.