Relational Operators (C++)

From RAD Studio
Jump to: navigation, search

Go Up to Binary Operators Index

Syntax

relational-expression  <   shift-expression
relational-expression  >   shift-expression
relational-expression  <=  shift-expression
relational-expression  >=  shift-expression

Considerations about Relational Operators

Use relational operators to test equality or inequality of expressions. If the statement evaluates to be true it returns a nonzero character; otherwise it returns false (0).

Relational Operator Description

>

greater than

<

less than

>=

greater than or equal to

<=

less than or equal to


In the expression:

E1 <operator> E2

the operands must follow one of these conditions:

  • Both E1 and E2 are of arithmetic type.
  • Both E1 and E2 are pointers to qualified or unqualified versions of compatible types.
  • Either E1 or E2 is a pointer to an object or incomplete type, and the other is a pointer to a qualified or unqualified version of void.
  • Either E1 or E2 is a pointer, and the other is a null pointer constant.