that the Expression is again calculated and the entire procedure will constantly be repeated until the
Expression takes on the value 0. An
Example:
while(a<10) a=a+2;
while(a)
{
a=a*2;
x=a;
}
break Instruction
If a break is executed within the loop then the loop will be left and the program execution starts with
the next instruction after the while loop.
continue Instruction
An execution of continue within a loop will immediately initialize a new calculation of the Expression
. Depending on the result the loop will be repeated at unequal 0. A result of
Example:
while(1)
{
a++;
if(a>10) break;
}
5.2.7
Functions
In order to structure a larger program it is separated into several sub-functions.
This not only improves the readability but allows to combine all program
instructions repeatedly appearing in functions. A program does in any case
contain the function "main", which is started in first place.
functions can be called up.
A simple example:
void func1(void)
{
// instructions in function func1
.
.
}
© 2008 Conrad Electronic
// endless loop
// will terminate the loop
Instruction Block
can be defined instead of a single instruction.
Compiler
0
will terminate the loop.
After that other
102
Need help?
Do you have a question about the C-Control Pro Mega Series and is the answer not in the manual?
Questions and answers