Relational operators - cradules/cs50 GitHub Wiki

Relational operators

  • These behave as you expect them to, and appear syntactically similar to how you may recall them from elementary arithmetic.

    • Less then (x < y)
    • Less then or equal to (x <= y)
    • Greater then (x > y)
    • Greater then or equal to ( x >= y)
  • C also can test two variables for equality and inequality

    • equality (x == y) inequality (x != y)
  • Be careful! It's common mistake to use the assignment operator (=) when you intend the equality operator (==)