1. Home
  2. Computing & Technology
  3. Delphi Programming
Glossary|Tips/Tricks|FREE App/VCL|Best'O'Net|Books|Link Back

Delphi Programming RTL Reference|By Category|Alphabetically|By Unit
 

SizeOf

unit
System
category
Miscellaneous routines

declaration
function SizeOf(X) : integer

description
Returns the number of bytes occupied by a variable or type

When you pass a variable reference to SizeOf it returns the number the varable occupies. Pass a type identifier to SizeOf to determine the number of bytes used to represent instances of that type.

example
var S: array[0..79] of char;

// Set to all zeros
FillChar(S, SizeOf(S), Ord('0'));

(* second example *)
type TOnlineAddress = record
    email: string[30];
    url: string[100];
  end;

var AOnlineAddress : TOnlineAddress;
//one AOnlineAddress variable holds SizeOf(AOnlineAddress) bytes.

in real code

see also
StringOfChar, FillChar,


 Free Delphi code snippet inside every Delphi Newsletter!
Subscribe to the Newsletter
Name
Email

 Got some code to share? Got a question? Need some help?
About.com Special Features

The Best Web Trends of the Decade

A look back at the best innovations, ideas and technologies over the last 10 years, More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >