Skip to main content
Logo image

Section 9.6 Combining Multiple Logic Statements

The way to write the logical AND in C is with two ampersand signs: &&

admin.....open in new window

The way to write the logical OR in C is with two vertical bars: ||

admin.....open in new window

The way to negate a condition in C is to put an exclamation mark in front of it: !(...)

admin.....open in new window

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?