Reference data type

A reference is a variable which only contains a link to a variable or to a function block instance. The used variable may be of elementary or derived data type.

  • A reference is declared using the keyword REFERENCE TO. Then, the name of the referrede data type follows.
  • The pointer is initialised using the REF= operator.


  MyRef: REF_TO INT;
  MyVar: INT;

MyVar:= 100;
MyRef:= REF(MyVar); //setting of a reference to a variable
MyRef:= 200;        //ther eis a new value of 200 in the variable now
  • © Energocentrum Plus, s.r.o. 2017 - 2022