◄Up► ◄Contents► ◄Index► ◄Back► ─────C/C++ Language───────────────────────────────────────────────────────── Keyword: sizeof Syntax: sizeof expression Summary: Gives the amount of storage, in bytes, associated with a variable or a type (including aggregate types). See also: ◄Operators► The <expression> is either an identifier or a type-cast expression (a type specifier enclosed in parentheses). When applied to a structure type or variable, sizeof returns the actual size, which may include padding bytes inserted for alignment. When applied to a statically-dimensioned array, sizeof returns the size of the entire array. The sizeof operator cannot return the size of dynamically-allocated arrays or external arrays. For example: int i = sizeof( int ); struct POS // sizeof( struct POS ) { // may not be two char row; // because of alignment char col; }; int array[] = { 1, 2, 3, 4, 5 }; // sizeof( array ) is 10 // sizeof( array[0] ) is 2 int sizearr = // Count of items in array sizeof( array ) / sizeof( array[0] ); -♦-