#ifdef command (like #if and #ifndef) can be used to conditionally include lines of text, this can be any other type of line or command except #elseif or #endif.

Note that this command only checks on a single variable .

A common use of this command is as a method of creating block comments. Simply specify a variable you know does not exist!

Syntax
#ifdef VariableName

The "VariableName" specifies a variable that should exist for the test to evaluate to true.

Example #1
#define Fruit 1
#ifdef Fruit
...
#endif

Example #2 - Block Comment
#ifdef DoesNotExist
This paragraph
has been commented out
as we are testing for
a variable we
know does not exist.
#endif

<u>#ifndef</u>
#ifndef command (like #ifdef) can be used to conditionally include lines of text, this can be any other type of line or command except #else or #endif.

Note that this command only checks on a single variable.
Syntax
#ifndef VariableName

The "VariableName" specifies a variable that should NOT exist for the test to evaluate to true.

Example
#define Fruit 1
#ifndef Fruit
...
#endif

<u>#endif</u>

This command is used to terminate a previous #ifdef or #ifndef command. There should be a matching #endif for every #ifdef or #ifndef command.

<u>#else</u>

This command is used if you wish to have some lines included when the #ifdef or #ifndef condition is false.

#define Fruit 1
#ifdef Fruit
...
#else

#endif

<u>#define</u>

#define NAME ?¢‚Ç¨‚Äú defines a simple macro. The name of the macro must begin with a letter and can consist of any combination of letters and numbers. Case is significant. This form is limiting, in that the variable names are fixed. More flexibility can be obtained by using a macro with arguments, described below.

#define NAME(a, b, c,) ?¢‚Ç¨‚Äú defines a macro with arguments. This can be used in more complex situations. The name of the macro must begin with a letter and can consist of any combination of letters and numbers. In fact, the implementation defines the arguments as simple macros. The names may be any choice of letters. Remember that case is significant in macro names.

<u>#include</u>
Using the include keyword, it becomes possible to write programs whose source code is longer than 32K or create files of frequently used code. The contents of the included file are functionally inserted into the line containing the include keyword.
For Windows CE OS, #include must contain the full path name. CE OS doesn't support relative path.

A simple macro is a kind of abbreviation. It is a name which stands for a fragment of code. Some people refer to these as manifest constants.

Before you can use a macro, you must define it explicitly with the `#define' command. `#define' is followed by the name of the macro and then the code it should be an abbreviation for.

For example,
*******************************************************************************/

#define BUFFER_SIZE 1020

/*******************************************************************************
defines a macro named `BUFFER_SIZE' as an abbreviation for the text `1020'. Therefore, if somewhere after this `#define' command there comes a Pocket C statement of the form
*******************************************************************************/

int Buffer[BUFFER_SIZE];

/*******************************************************************************
After the preprocessor expands a macro name, the macro's definition body is appended to the front of the remaining input, and the check for macro calls continues. Therefore, the macro body can contain calls to other macros. For example.
*******************************************************************************/

#define BUFSIZE 1020
#define TABLESIZE BUFSIZE

/*******************************************************************************
the name `TABLESIZE' when used in the program would go through two stages of expansion, resulting ultimately in `1020'.

To define a macro that uses arguments, you write a `#define' command with a list of argument names in parentheses after the name of the macro. The argument names may be any valid C identifiers, separated by commas and optionally whitespace. The open-parenthesis must follow the macro name immediately, with no space in between.