ADVANCED: SIZEOF

Top  Previous  Next

The SIZEOF operator returns the size of VPL object in bytes.  
The actual type returned depends on the size of the object. If the size is less than 32767 then the type returned will be an INT - else it will be returned as a DINT.

 

 

 

Example:

INCLUDE rtcu.inc
 
VAR
  a : DINT;
  b : INT;
END_VAR;
 
PROGRAM test;
 
BEGIN
  ...
  // assign the size of 'a' in bytes to 'b' (in this case 4)
  b := SIZEOF(a);
  ...
END;
 
END_PROGRAM;