Punctuators, Mikroc – ABL electronic PIC Microcontrollers PIC16 User Manual

Page 56

Advertising
background image

The mikroC punctuators (also known as separators) include brackets, parentheses,
braces, comma, semicolon, colon, asterisk, equal sign, and pound sign. Most of
these punctuators also function as operators.

Brackets

Brackets

[ ]

indicate single and multidimensional array subscripts:

char

ch, str[] = "mikro";

int

mat[3][4];

/* 3 x 4 matrix */

ch = str[3];

/* 4th element */

Parentheses

Parentheses

( )

are used to group expressions, isolate conditional expressions,

and indicate function calls and function parameters:

d = c * (a + b);

/* override normal precedence */

if

(d == z) ++x;

/* essential with conditional statement */

func();

/* function call, no args */

void func2(int n);

/* function declaration with parameters */

Parentheses are recommended in macro definitions to avoid potential precedence
problems during expansion:

#define CUBE(x) ((x)*(x)*(x))

For more information, refer to Expressions and Operators Precedence.

mikroC - C Compiler for Microchip PIC microcontrollers

mikroC

making it simple...

48

MikroElektronika: Development tools - Books - Compilers

page

PUNCTUATORS

Advertising
This manual is related to the following products: