+ 2
Why does sizeof(x++) not increment x? -
6 ответов
+ 2
HBhZ_C I don't think this is what happens. sizeof is evaluated at compile time so the x++ has no effect at all, it's simply ignored at runtime. This means both sizeof(x++) and sizeof(++x) are treated like a simple sizeof(x).
+ 1
This statement will be evaluated to:
sizeof(x);
x++;
So if you display x value now:
printf("%d",x);???
+ 1
HBhZ_C okey okey got it.👍
+ 1
Read about postfix and prefixing in c and c plus plus RAJ PATIL .
+ 1
Yes Aaron Eberhardt x++ has not effect in sizeof method then outside if x is called it will be affected by last increment.So it will not conserve its first value.Use printf instead of sizeof to test again.