Which order the functions would be called?

In the following code, in which order the functions would be called?
a= f1(23,14)*f2(12/4)+f3();

Showing Answers 1 - 1 of 1 Answers

jbode

  • Mar 3rd, 2015
 

The order is not specified; f1(), f2(), and f3() may be called in any order. Operator precedence does not control order of evaluation. f1() and f2() must be called before the result of f1() * f2() may be computed, but that doesnt mean that f1() must be called before f2(), nor that both f1() and f2() must be called before f3().

Chapter and verse:

6.5 Expressions
...
3 The grouping of operators and operands is indicated by the syntax.85) Except as specified
later, side effects and value computations of subexpressions are unsequenced.86)

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions