O'Reilly logo

C Primer Plus, Fourth Edition by Stephen Prata

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Key Concepts

One aspect of intelligence is the ability to adjust one's responses to the circumstances. Thus, selection statements are the foundation for developing programs that behave intelligently. In C, the if, if else, and switch statements, along with the conditional operator (?:), implement selection.

The if and if else statements use a test condition to determine which statements are executed. Any non-zero value is treated as true, while zero is treated as false. Typically, tests involve relational expressions, which compare two values, and logical expressions, which use logical operators to combine or modify other expressions.

One general principle to keep in mind is that if you want to test for two conditions, you should use a logical ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required