Next: Related issues Up: Decisions Previous: Relational operators

Logical operators

it is often necessary to create a logical condition to control a loop etc. We have the following operators to help:

All have lower precedence than relational/equality operators.

Logical expressions are evaluated left to right only until the truth/falsehood is determined.

Example

   if ( character == '\n' || character == '?' || count > 20 )
      printf("\nInput finished\n");



Next: Related issues Up: Decisions Previous: Relational operators


maspjw@
Tue Sep 27 15:29:34 BST 1994