C Programming Absolute Beginner's Guide (3rd Edition)

(Romina) #1
TABLE 9.1 Order of Operators

Here is a difficult expression. All the variables and numbers are integers. See if you can figure out the
answer by the way C would evaluate the expression:


Click here to view code image


ans = 5 + 2 * 4 / 2 % 3 + 10 - 3; /* What is the answer? */

Figure 9.1 shows how to solve for the answer, 13.


FIGURE 9.1 Solving the expression the way C would.

Tip

Don’t do too much at one time when evaluating such expressions for practice. As the
Free download pdf