Node:SizeOf, Next:, Previous:Single, Up:Reference



SizeOf

Synopsis


function SizeOf (var x): SizeType;

Description

Returns the size of a type or variable in bytes.

SizeOf can be applied to expressions and type names. If the argument is a polymorphic object, the size of its actual type is returned.

Conforming to

SizeOf is a UCSD Pascal extension.

Example


program SizeOfDemo;
var
  a: Integer;
  b: array [1 .. 8] of Char;
begin
  WriteLn (SizeOf (a));        { Size of an `Integer'; often 4 bytes. }
  WriteLn (SizeOf (Integer));  { The same. }
  WriteLn (SizeOf (b))         { Size of eight `Char's; usually 8 bytes. }
end.

See also

BitSizeOf, AlignOf, TypeOf.