ABL electronic PIC16 Personal Computer User Manual


 
You can use goto to break out from any level of nested control structures. But,
goto cannot be used to jump into block while skipping that block’s initializations
– for example, jumping into loop’s body, etc.
Use of goto statement is generally discouraged as practically every algorithm can
be realized without it, resulting in legible structured programs. One possible appli-
cation of
goto statement is breaking out from deeply nested control structures:
for (...) {
for (...) {
...
if (disaster) goto Error;
...
}
}
.
.
.
Error:
/* error handling code */
Return Statement
Use the
return statement to exit from the current function back to the calling
routine, optionally returning a value. Syntax is:
return [
expression
];
This will evaluate the
expression
and return the result. Returned value will be
automatically converted to the expected function type, if needed. The
expres-
sion
is optional; if omitted, function will return a random value from memory.
Note: Statement
return in functions of void type cannot have an
expression
in fact, you can omit the return statement altogether if it is the last statement in
the function body.
MikroElektronika:
Development
tools
-
Books
-
Compilers
12 3
page
mikroC
- C Compiler for Microchip PIC microcontrollers
mikroC
making it simple...