Search code examples
cexecutionevaluation

What is the difference between execution and evaluation?


We say that expresssions "evaluate" values and statement orders computer to "execute". But to me it seems like same terminology. What is the difference between execution and evaluation in C?


Solution

  • When a statement is executed then it comes to the action of evaluation of its expressions. First execution takes place and then evaluation.

    In the snippet

    int i = 5, j;
    j = 10 + 5*i;
    

    when the statement j = 10 + 5*i; is executed then evaluation of expressions j, 10, 5*i, 10 + 5*i and j = 10 + 5*i takes place. Note that first three can be evaluated in any order.