SizeOf
 
Returns the size of a variable or type in bytes.

Syntax

SizeOf ( variable | DataType )

Description

The Sizeof operator returns the length of a variable or DataType.

Different from Len, when used with fixed-length strings (including ZStrings and WStrings) it will return the number of bytes allocated, and when used with variable-length strings, it will return the size of the string descriptor.

Example

Print SizeOf(Byte) ' returns 1

Type bar
    a As Integer
    b As Double
End Type
Dim foo As bar
Print SizeOf(foo)



Dialect Differences

  • Not available in the -lang qb dialect unless referenced with the alias __Sizeof.

Differences from QB

  • New to FreeBASIC

See also