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

Summary

This chapter has presented quite a few topics to review, so let's get to it. The if statement uses a test condition to control whether a program executes the single simple statement or block following the test condition. Execution occurs if the test expression has a nonzero value and doesn't occur if the value is zero. The if else statement enables you to select from two alternatives. If the test condition is nonzero, the statement before the else is executed. If the test expression evaluates to zero, the statement following the else is executed. By using another if statement to immediately follow the else, you can set up a structure that chooses between a series of alternatives.

The test condition is often a relational expression, that ...

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