C: What is the output of the following code? And please explain [duplicate]

The order of evaluation in a==++a is not defined by the standard. Thus the ++ can be performed before the comparison or after comparison. With another compiler you can get different results. This is called ‘UB’, or ‘Undefined Behavior’.

Leave a Comment