Expression Statements; Selection Statements - mikroElektronika PIC Microcontrollers PIC12 User Manual

Mikroc user's manual
Table of Contents

Advertisement

mikroC - C Compiler for Microchip PIC microcontrollers

Expression Statements

Any expression followed by a semicolon forms an expression statement:
expression ;
mikroC executes an expression statement by evaluating the
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 (
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:
and
If Statement
Use
if ( expression ) statement1 [else statement2 ]
When
false,
value; otherwise, the condition is ill-formed. Parentheses around the
are mandatory.
The
the
else
page
116
.
switch
to implement a conditional statement. Syntax of
if
evaluates to true,
expression
executes. The
statement2
keyword is optional, but no statements can come between the
else
.
MikroElektronika: Development tools - Books - Compilers
if
executes. If expression is
statement1
must evaluate to an integral
expression
mikroC
making it simple...
. All side
expression
). The null
;
if
statement is:
expression
and
if

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the PIC Microcontrollers PIC12 and is the answer not in the manual?

This manual is also suitable for:

Pic microcontrollers pic16Pic microcontrollers pic18

Table of Contents