Compound Statement or Block [ HP C/iX Reference Manual ] MPE/iX 5.0 Documentation
HP C/iX Reference Manual
Compound Statement or Block
Compound or block statements allow you to group other statements together
in a block of code.
Syntax
compound-statement ::=
{[declaration-list][statement-list]}
declaration-list ::=
declaration
declaration-list declaration
statement-list ::=
statement
statement-list statement
Description
You can group together a set of declarations and statements and use them
as if they were a single statement. This grouping is called a compound
statement or a block.
Except when declared as extern, variables and constants declared in a
block are local to that block and any subordinate blocks declared
therein. If the objects are initialized, the initialization is performed
each time the compound statement is entered from the top through the left
brace ({) character. If the statement is entered via a goto statement or
in a switch statement, the initialization is not performed.
Any object declared with static storage duration is created and
initialized when the program is loaded for execution. This is true even
if the object is declared in a subordinate block.
Example
if (x != y)
{
int temp;
temp = x;
x = y;
y = temp;
}
MPE/iX 5.0 Documentation