Table of Contents
Previous Section Next Section

sizeof

The sizeof compile-time operator returns the length (in bytes) of the variable or type it precedes. If it precedes a type, that type must be enclosed in parentheses. If it precedes a variable, the parentheses are optional. For example, given

int i;
cout << sizeof(int);
cout << sizeof i;

both output statements will print 4 in most 32-bit environments.

For C99, sizeof is evaluated at runtime when it is applied to a variable-length array.


Table of Contents
Previous Section Next Section