Home Segments Index Top Previous Next

132: Sidetrip

A compound statement, also known as a block, is a group of statements surrounded by braces. A compound statement can have its own local variables.

The scope of the local variables declared in a compound statement is the compound statement itself. The extent of such local variables is the time during which the compound statement is executed.

Note that function bodies are compound statements. You see other examples in the hardcopy version of this book, because compound statements are used liberally inside C's if and if-else statements.