Explaination for printf with comparing variables as arguments

C standard says:

C11: 6.5 (p2):

If a side effect on a scalar object is unsequenced relative to either a different side effect on the same scalar object or a value computation using the value of the same scalar object, the behavior is undefined […]

This means your program invokes undefined behavior. In the statements

printf("%d %d %d",a==b,a=b,a<b);  


printf("%d %d %d",a<b,a>b,a=b);

the side effect to a is unsequenced because standard says:

Leave a Comment