liveBook · Manning

Chapter 3: Everything is about control

What you will learn in chapter 3 of Modern C, Third Edition

This introduction contrasts unconditional function calls and returns with conditional control statements, then identifies the roles of C’s five conditional statements.

After this chapter you will be able to

What it builds on

Section by section

Introduction

This introduction contrasts unconditional function calls and returns with conditional control statements, then identifies the roles of C’s five conditional statements.

Key terms: functions, call, return statement, for statement, controlling condition, conditional control statements, if, for, do, while

3.1 Conditional execution

This section explains how C’s if and else select code paths, how scalar values act as conditions, and how to write clear truth-value tests.

Key terms: if, else, controlling expression, secondary block, selection statement, code paths, scalar, truth value, logical false, logical true

3.2 Iterations

This section explains C’s three iteration statements, how break and continue alter a loop, and how loops are used in a program that computes multiplicative inverses.

Key terms: for statement, clause1, condition2, expression3, scope, while, do, condition, secondary block, break

3.3 Multiple selection

This section explains how switch selects among multiple cases, how execution continues after a case label, and what restrictions make switches safe to use.

Key terms: switch statement, case, default, case labels, jump targets, break, integer constant expressions, case values, variable definitions, initializer

3.4 Summary

Where this is used later

Concepts explained in this chapter

← Chapter 2: The principal structure of a program Chapter 4: Expressing computations →

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.