Search⌘ K

Relational Operators

Explore how relational operators in C++ compare different data types such as integers, floats, characters, and strings. Learn how these operators return boolean values and avoid common syntax errors when using them. This lesson helps you write and understand comparisons essential for controlling program flow.

Introduction to relational operators

A relational operator compares the value of two operands.

📝 The output of a relational operator is a bool data type.

Here is the list of relational operators available in C++:

Example program with int

Consider two operands of type int. ...