Braces ('{...}')

Previous Punctuators Next

The { } braces indicate the start and end of a compound statement. Each sequence of statements (terminated by semicolons) is treated as a single statement, called compound statement. Compound statements may have its own local variables as well.

Braces are also used in declaration of enumerations, structures and unions, as well as for function definitions. For example:

int square (int x);               // This is a function prototype
int square (int x) {return x*x;}  // This is a function definition
Note: The GNU C extends the usage of braces (together with parentheses) to allow making statement expressions. They are also used in cast constructors, which are yet another GNU C extension.