Here is the code compiled in dev c++ windows:
#include
int main() {
int x = 5;
printf(\"%d and \", sizeof(x++)); // note 1
print
sizeof runs at compile-time, but x++ can only be evaluated at run-time. To solve this, the C++ standard dictates that the operand of sizeof is not evaluated. The C Standard says:
If the type of the operand [of
sizeof] is a variable length array type, the operand is evaluated; otherwise, the operand is not evaluated and the result is an integer constant.