[Solved] Expression evaluation problems in C++

[ad_1]

In general, in C++, the order of evaluation of subexpressions is unspecified. Check out the link for more discussion, and some exceptional cases.

The C++ standard says:

Except where noted, evaluations of operands of individual operators
and of subexpressions of individual expressions are unsequenced.[…]

The compiler may decide which argument of print (in your example) to evaluate first, based on efficiency or some other considerations. You should never rely on the order.

[ad_2]

solved Expression evaluation problems in C++