Kernighan & Ritchie (in the book the C programming language) says that the order of a function call in an expression cannot be evaluated (section 2.12, third and fourth paragraph)
for eg :
x = f() + g() * h();
the book says any of these functions can be evaluated based on the compiler.
Please explain why is this only for functions,
as everybody knows that when we say
a = 1;
b = 5;
c = 10;
d = a + b * c;
the order of evaluation is b*c (viz = z, say) first and
then a+z (viz = y, say) and then d = y
thus some method of evaluation of expression is used.
1 -> address of a is stored in operand stack (od),
2 -> '+' is pushed into operator stack (otr),
3 -> address of b is pushed into od,
4 -> compares the precedence of the next operator and top
of otr stack, if great pushes '*' into otr stack and
proceeds with next operand
5 -> address of c is pushed into od,
6 -> end of expression, so resolves b and c performes
operation '*' and so on....
thus the order of evaluation is b c and then a.
in the above x = f() + g() * h(),
the function pointers an be stored in the operand stack, thus the order can be dermined.