Mikroc – ABL electronic PIC Microcontrollers PIC16 User Manual

Page 57

Advertising
background image

Braces

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 semi-
colon is not required after the }, except in structure declarations. Often, the semi-
colon 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));

MikroElektronika: Development tools - Books - Compilers

49

page

mikroC - C Compiler for Microchip PIC microcontrollers

mikroC

making it simple...

Advertising
This manual is related to the following products: