Chapter 11

The Unavoidable Math Chapter

IN THIS CHAPTER

check Using the ++ and -- operators

check Making the modulus useful

check Employing various operator shortcuts

check Working with various math functions

check Creating random numbers

check Understanding the order of precedence

One of the reasons I shunned computers in my early life was that I feared the math. Eventually, I learned that math doesn't play a central role in programming. On one hand, you need to know some math, especially when a program involves complex calculations. On the other hand, it’s the computer that does the math — you just punch in the formula.

In the programming universe, math is necessary but painless. Most programs involve some form of simple math. Graphics programming uses a lot of math. And games wouldn’t be interesting if it weren’t for random numbers. All this stuff is math. I believe that you’ll find it more interesting than dreadful. ...

Get C Programming For Dummies, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.