TOC | Prev | Next

Statements and blocks

C programs are based on statements, grouped in blocks.

n = 4;
x = n * 17;

All statements end with a semicolon. The semicolon is a terminator,
not separator, so it is not optional.

A block is a group of zero or more statements. Wherever you can
have a statement, you can have a block.

if ( n > 4 )
    do_something();

if ( n < 1 ) {
    do_something();
    do_something_else();
}
TOC | Prev | Next