For the following code:
int main()
{
int a, b, c, d;
c = 5;
d = 5;
a = 10;
b = 8;
if (a == c++ && b < d++);
printf("c=%d d=%d\n", c, d);
return 0;
}
Output: c=6 d=5
I know, since the first expression in the if expression takes the value false, the second expression is not evaluated and therefore is output. However, I read the following words in ANSI C from Balaguruswamy:
Since the operator <has a higher priority than ==, b < d++first evaluated, and then a == c++.
Now, according to this, the value dshould not be 6, but not c?
source
share