ABL electronic PIC16 Personal Computer User Manual


 
Expression Statements
Any expression followed by a semicolon forms an expression statement:
expression
;
mikroC executes an expression statement by evaluating the expression. All side
effects from this evaluation are completed before the next statement is executed.
Most expression statements are assignment statements or function calls.
The null statement is a special case, consisting of a single semicolon (
;). The null
statement does nothing, and is therefore useful in situations where the mikroC syn-
tax expects a statement but your program does not need one. For example, null
statement is commonly used in “empty” loops:
for (; *q++ = *p++ ;);
/* body of this loop is a null statement */
Selection Statements
Selection or flow-control statements select from alternative courses of action by
testing certain values. There are two types of selection statements in C:
if
and switch.
If Statement
Use
if to implement a conditional statement. Syntax of if statement is:
if (
expression
)
statement1
[else
statement2
]
When
expression
evaluates to true,
statement1
executes. If expression is
false,
statement2
executes. The
expression
must evaluate to an integral
value; otherwise, the condition is ill-formed. Parentheses around the
expression
are mandatory.
The
else keyword is optional, but no statements can come between the if and
the
else.
mikroC
- C Compiler for Microchip PIC microcontrollers
mikroC
making it simple...
11 6
MikroElektronika:
Development
tools
-
Books
-
Compilers
page