Practice test review question for C course.
int c = f1(2,3) * f2(3,4) + f3(4,5);
What is the order of the function evaluation? Answer was compiler dependent. My question: Why doesn't it use the left to right associativity and precedence of the *,+ operators? I changed it to f1()+f2()*f3(), and placed puts("f1 now) type commands in each function for a quick test. The result was order f1,f2,f3, so it is clearly not using the operator associativity and precedence for evaluation order of the functions. I was pondering the consequences that the 3 functions set/manipulate 3 global variables, so the evaluation order would matter.
Other than, don't write code like this (It was a practice review question), I am confused why operator precedence/associativity does not dictate the order of the function evaluations. Thanks in advance.