When the preprocessor reads a line, it replaces MAX (a ++, b ++) in printf with (a ++> b ++? A ++; b ++)
So your function becomes
printf(a,b,(a++>b++?a++;b++));
Here the evaluation order is "compiler dependent".
To understand when these conditions may arise, you need to understand the point of the sequence.
At each point in the sequence, side effects of all previous expressions will be completed (all variable calculations will be completed). This is why you cannot rely on expressions such as:
a[i] = i++;
since for the assignment, increment, or index operators there is no specified point in the sequence, you do not know when the increment effect on i occurs. “Between the previous and the next point in the sequence, the object must have a value that its stored value has been changed no more than once by evaluating the expression. In addition, the previous value should only be read to determine the value to be stored.” If a program violates these rules, the results for any particular implementation are completely unpredictable (undefined).
- The sequence points specified in the Standard are as follows:
1) The function call point after evaluating its arguments.
2) The end of the first operand && Operator.
3) The end of the first operand || Operator.
4) The end of the first operand of the conditional operator:
5) The end of each operand of a comma operator.
6) Completion of the evaluation of the full expression. They are as follows:
Initializer evaluation of an automatic object.
An expression in a “regular expression” is an expression followed by a semicolon.
Control expressions in do, while, if, switch or for statements.
The other two expressions in the for statement.
The expression in the return statement.