In C, sizeof operator works on following kind of operands:
1) type-name: type-name must be specified in parentheses.
2) expression: expression can be specified with or without the parentheses.
The expression is used only for getting the type of operand and not evaluated. For example, below code prints value of i as 5.
Output of the above program:
size of i = depends on compiler
value of i = 5
- sizeof operator in C
- G-Fact 1 | (Sizeof is an operator)
- Is sizeof for a struct equal to the sum of sizeof of each member?
- Evaluation order of operands
- Order of operands for logical operators
- Implement Your Own sizeof
- Why does sizeof(x++) not increment x in C?
- sizeof() for Floating Constant in C
- Anything written in sizeof() is never executed in C
- Do not use sizeof for array parameters
- Why overriding both the global new operator and the class-specific operator is not ambiguous?
- How to find size of array in C/C++ without using sizeof ?
- Difference between strlen() and sizeof() for string in C
- map::operator in C++ STL
- set operator= in C++ STL