Copy Code code as follows:
#include <stdio.h>
int main ()
{
int i;
i = 10;
printf ("%d\n", I);
printf ("%d\n", sizeof (i++));
printf ("%d\n", I);
return 0;
}
What should these three lines of output be?
The answer is:
10
4
10
The third one, why not 11? Why did I not increase myself?
Please see the C + + standard;
5.3.3 sizeof
The sizeof operator yields the number of bytes in the object representation to its operand. The operand is either a expression, which are an unevaluated operand (Clause 5), or a parenthesized type-id.
That is, if the operand of the sizeof is an expression, the expression will not be computed.
sizeof when preprocessing look on the line, it is behind the parentheses, it is not evaluated at all, only according to the C of a pile of rules to determine the result type, and then return the size of the result type
The same is true of the other operator typeID.