VOOZH about

URL: https://www.geeksforgeeks.org/cpp/cpp-comparison-operators/

⇱ C++ Comparison Operators - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

C++ Comparison Operators

Last Updated : 31 Mar, 2026

Comparison operators are operators used for comparing two elements, these are mostly used with if-else conditions as they return true-false as result.

There are mainly 6 Comparison Operators:

👁 operator
Comparison operators in C++ and their logical results

Note: Comparison Operators have only two return values, either true (1) or false (0).

Example Code to cover all 6 Comparison Operators: 


Output
a is greater than b
a is greater than or equal to b
a is lesser than b
a is lesser than or equal to b
a is equal to b
a is not equal to b
Comment