mikroC - C Compiler for Microchip PIC microcontrollers
Sizeof Operator
Prefix unary operator
bytes of how much memory space is used by its operand (determined by its type,
with some exceptions).
Operator
operand. You cannot use
types, parenthesized names of such types, or with an lvalue that designates a bit
field object.
Sizeof Applied to Expression
If applied to expression, size of the operand is determined without evaluating the
expression (and therefore without side effects). Result of the operation will be the
size of the type of the expression's result.
Sizeof Applied to Type
If applied to a type identifier,
for type size is the
sizeof(char)
sizeof(char)
sizeof(int)
sizeof(unsigned long)
When the operand is a non-parameter of array type, the result is the total number
of bytes in the array (in other words, an array name is not converted to a pointer
type):
int i, j, a[10];
//...
j = sizeof(a[1]);
i = sizeof(a);
If the operand is a parameter declared as array type or function type,
gives the size of the pointer. When applied to structures and unions,
the total number of bytes, including any padding. Operator
applied to a function.
page
112
returns an integer constant that gives the size in
sizeof
can take either a type identifier or an unary expression as an
sizeof
sizeof
sizeof
sizeof(char)
gives the result 1, whether the char is signed or unsigned.
/* returns 1 */
/* returns 2 */
/* returns 4 */
/* j = sizeof(int) = 2 */
/* i = 10*sizeof(int) = 20 */
MikroElektronika: Development tools - Books - Compilers
with expressions of function type, incomplete
returns the size of the specified type. Unit
which is equivalent to one byte. Operation
mikroC
making it simple...
sizeof
gives
sizeof
cannot be
sizeof
Need help?
Do you have a question about the PIC Microcontrollers PIC12 and is the answer not in the manual?