Mikroelektronika MIKROE-738 Datenbogen

Seite von 682
256
mikoC PRO for PIC32
MikroElektronika
Compound Statements (Blocks)
The  compound  statement,  or  block,  is  a  list  (possibly  empty)  of  statements  enclosed  in  matching  braces 
{  }
Syntactically, the block can be considered to be a single statement, but it also plays a role in the scoping of identifiers. 
An identifier declared within the block has a scope starting at the point of declaration and ending at the closing brace. 
Blocks can be nested to any depth up to the limits of memory.
For example, the 
for
 loop expects one statement in its body, so we can pass it a compound statement:
for (i = 0; i < n; i++ ) {
  int temp = a[i];
  a[i] = b[i];
  b[i] = temp;
}
Note that, unlike other statements, compound statements do not end with semicolon (
;
), i.e. there is never a semicolon 
following the closing brace.
Preprocessor
Preprocessor is an integrated text processor which prepares the source code for compiling. Preprocessor allows:
 
- inserting text from a specifed file to a certain point in the code (see File Inclusion), 
 
- replacing specific lexical symbols with other symbols (see Macros), 
 
- conditional compiling which conditionally includes or omits parts of the code (see Conditional Compilation). 
Note that preprocessor analyzes text at token level, not at individual character level. Preprocessor is controled by 
means of preprocessor directives and preprocessor operators.
Preprocessor Directives
Any line in the source code with a leading 
is taken as a preprocessing directive (or control line), unless 
#
 is within 
a string literal, in a character constant, or embedded in a comment. The initial
  #
 can be preceded or followed by a 
whitespace (excluding new lines).
null directive consists of a line containing the single character 
#
. This line is always ignored.
Preprocessor directives are usually placed at the beginning of the source code, but they can legally appear at any 
point in a program. The mikroC PRO for PIC32 preprocessor detects preprocessor directives and parses the tokens 
embedded in them. A directive is in effect from its declaration to the end of the program file.
Here is one commonly used directive:
#include <math.h>