Building Expressions Using Operators
Learn about arithmetic, relational, and logical operators and how they can be used for building C expressions.
We'll cover the following...
We'll cover the following...
Like in any other programming language, in C, there are many arithmetic, relational, and logical operators. These operators can be used to create expressions that are made up of simpler basic types and constants. A C expression always evaluates to some value.
Arithmetic operators
The following binary arithmetic operators can be used in C: +, -, *, /, and %. The first four of these are for addition, subtraction, multiplication, and division. The last one (%) is the modulo operator, which, applied to two values, computes the remainder from dividing the first operand by the second operand: