mikroC

making it simple...

Braces

mikroC - C Compiler for Microchip PIC microcontrollers

Braces { } indicate the start and end of a compound statement:

if (d == z) { ++x; func();

}

The closing brace serves as a terminator for the compound statement, so a semicolon is not required after the }, except in structure declarations. Often, the semicolon is illegal, as in

if (statement)

 

{ ... };

/* illegal semicolon! */

else

 

{ ... };

 

For more information, refer to Compound Statements.

Comma

The comma (,) separates the elements of a function argument list:

void func(int n, float f, char ch);

The comma is also used as an operator in comma expressions. Mixing the two uses of comma is legal, but you must use parentheses to distinguish them. Note that (exp1, exp2) evalutates both but is equal to the second:

/* call func with two args */ func(i, j);

/* also calls func with two args! */ func((exp1, exp2), (exp3, exp4, exp5));

 

 

page

MikroElektronika: Development tools - Books - Compilers

49