# include & lt; Stdio. H>
Void f (int I) {
Printf (" % d, % d, % d, % d \ n ", I, i++, i++, i++);
}
Void f2 (int I) {
Printf (" % d, % d, % d, % d \ n ", I, i++, + + I + + I);
}
Int main (void)
{
int i=1;
Int a=1;
F (I);
F2 (I);
return 0;
}
But f2 () function to print the result is 4344, according to the "advanced" principle of stack should be 4332, but is wrong), anyone know the reason?
CodePudding user response:
+ + I, I, after the return value is increasing i++ the return value is temporary variables (incrementing before I value)So the f2 is equivalent to
Printf (I, increasing for the last time before I, I, I)
CodePudding user response:
It is well known that the wrong don't have to see the content behind theAs is known to all that is wrong without this
Here the deciding factor is evaluated order
Has nothing to do and stack order
The output meaningless compiler has a variety of different understanding