Demonstrate how to get the size of a variable.

See also: Host introspection

' FB 1.05.0 Win64
 
Dim i As Integer
Dim l As Long
Dim s As Short
Dim b As Byte
Print "An integer occupies "; SizeOf(i); " bytes"
Print "A  long occupies    "; SizeOf(l); " bytes"
Print "A  short occupies   "; SizeOf(s); " bytes"
Print "A  byte occupies    "; SizeOf(b); " byte"
 
' or use type directly rather than a variable
 
Print "A  boolean occupies "; SizeOf(Boolean); " byte"
Print "A  single occupies  "; SizeOf(Single);  " bytes"
Print "A  double occupies  "; SizeOf(Double);  " bytes"
 
Print
Print "Press any key to quit"
Sleep
 