Relational and Equality Operators in C - C Reference

C examples for Reference:Language Reference

Description

Relational and Equality Operators in C

Operator            Name                                  Example              Result          Meaning
>                   Greater than                          9 > 1                 1              True
                                                          2 > 9                 0              false
>=                  Greater than or equal to              8 >= 8                1              True
                                                          6 >= 1                1              true
                                                          2 >= 9                0              false
<                   Less than                             1 < 9                 1              True
                                                          8 < 3                 0              false
<=                  Less than or equal to                 1 <= 1                1              true
                                                          2 <= 9                1              true
                                                          7 <= 2                0              false
==                  Equal to                              4 == 4                1              true
                                                          5 == 9                0              false
!=                  Not equal to                          3 != 8                1              true
                                                          7 != 7                0              false
&&                  logical AND                           1 && 1                1              True
                                                          1 && 0                0              False
                                                          0 && 1                0              False
                                                          0 && 0                0              False
||                  logical OR                            1 || 1                1              True
                                                          1 || 0                1              true
                                                          0 || 1                1              true
                                                          0 || 0                0              false
!                   logical NOT                           !1                    0              false
                                                          !0                    1              true

Related Tutorials