Relational Operators

Each operator compares the value at its left to the value at its right.

<Less than
<=Less than or equal to
==Equal to
>=Greater than or equal to
>Greater than
!=Unequal to

Relational Expressions

A simple relational expression consists of a relational operator with an operand on each side. If the relation is true, the relational expression has the value 1. If the relation is false, the relational expression has the value 0.

5 > 2 is true and has the value 1.

(2 + a) == a is false and has the value 0.

Get C Primer Plus®, Third 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.