Appendix A. Leftovers: The top ten things (we didn’t cover)

Even after all that, there’s still a bit more.
There are just a few more things we think you need to know. We wouldn’t feel right about ignoring them, even though they need only a brief mention, and we really wanted to give you a book you’d be able to lift without extensive training at the local gym. So before you put the book down, read through these tidbits.
#1. Operators
We’ve used a few operators in this book, like the basic
arithmetic operators +, -,
*, and /, but there are many other operators
available in C that can make your life easier.
Increments and decrements
An increment and a decrement increase and decrease a number by 1. That’s a very common operation in C code, particularly if you have a loop that increments a counter. The C language gives you four simple expressions that simplify increments and decrements:

Each of these expressions will change the value of i. The position of the ++ and --
say whether or not to return the original value of i or its new value. For example:
The ternary operator
What if you want one value if some condition is true, and a different value if it’s false?
if (x == 1) return 2; else return ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access