Chapter 4

Operators

Now that you’ve been introduced to the concepts of C data types, variables, and constants, it is time to learn how to manipulate their values. C provides a rich set of operators that are used to build expressions and perform operations on them. In this chapter, we’ll present some of C’s most important operators. We’ll introduce the rest gradually over the next several chapters, and you’ll see how to apply them when building more complex programs.

Assignment Operator

The = operator is used to assign a value to a variable. For example, the statement a = 10; assigns the value 10 to the variable a, while the statement a = k; assigns the value of the variable k to a.

When used in a chained assignment, the assigned value ...

Get C 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.