Skip to content

Latest commit

 

History

History
12 lines (9 loc) · 394 Bytes

6.35.md

File metadata and controls

12 lines (9 loc) · 394 Bytes

The order of evaluation is undefined for the operator *, thus the expression return factorial(val--) * val make equal to either of the following expressions:

// Version 1
auto tmp = factorial(val) * val;  // evaluate second operand first
--val;
return tmp;

// Version 2
auto tmp = factorial(val);
--val;
return tmp * val;  // evaluate first operand first