Iteration Statements; While Statement - mikroElektronika PIC Microcontrollers PIC12 User Manual

Mikroc user's manual
Table of Contents

Advertisement

mikroC
making it simple...

Iteration Statements

Iteration statements let you loop a set of statements. There are three forms of itera-
tion statements in C:

While Statement

Use the
statement is:
while ( expression ) statement
The
takes place before
on the first pass, the loop does not execute.
Parentheses around
Here is an example of calculating scalar product of two vectors, using the
statement:
int s = 0, i = 0;
while (i < n) {
s += a[i] * b[i];
i++;
}
Note that body of a loop can be a null statement. For example:
while (*q++ = *p++);
MikroElektronika: Development tools - Books - Compilers
while
keyword to conditionally iterate a statement. Syntax of
while
executes repeatedly until the value of expression is false. The test
statement
statement
expression
mikroC - C Compiler for Microchip PIC microcontrollers
,
, and
.
do
for
executes. Thus, if
expression
are mandatory.
while
evaluates to false
while
page
119

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?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Pic microcontrollers pic16Pic microcontrollers pic18

Table of Contents