Boolean Expressions - cradules/cs50 GitHub Wiki

Boolean Expressions

  • Boolean expressions are used in C for comparing values.
  • All Boolean expressions in C evaluate the one of two possible values - true or false
  • We can use the results of evaluating a Boolean expression in other programming constructs such as decided which branch in a conditional to take, or determining what ever a loop should continue run
  • Sometimes when working with Boolean expressions we will use variables of type bool, but we don't have to.
  • In C, every nonzero value is equivalent to true, and zero is false.
  • Two main types of Boolean expressions: logical operators an relational operators.