Skip to main content

Section 9.7 Combining Multiple Logic Statements

The way to write the logical AND in C is with two ampersand signs: &&
The way to write the logical OR in C is with two vertical bars: ||
The way to negate a condition in C is to put an exclamation mark in front of it: !(...)

Investigate 9.4.

Zero is the value which C interprets as false. How could you use a logical operator so that C would interpret anything except zero as false, such as in an if statement?