The C Preprocessor Versus the Compiler
One important thing you need to remember is that the C preprocessor is not part of the C compiler.
The C preprocessor uses a different syntax. All directives in the C preprocessor begin with a pound sign (#). In other words, the pound sign denotes the beginning of a preprocessor directive, and it must be the first nonspace character on the line.
The C preprocessor is line oriented. Each macro statement ends with a newline character, not a semicolon. (Only C statements end with semicolons.) One of the most common mistakes made by the programmer is to place a semicolon at the end of a macro statement. Fortunately, many C compilers can catch such errors.
The following sections describe some of the most frequently used directives, such as
TIP
Macro names, especially those that will be substituted with constants, are normally represented with uppercase letters so that they can be distinguished from other variable names in the program.
The C Preprocessor Versus the Compiler
Related Items
The continue Statement
The continue Statement
The break Statement
The break Statement
You can add a break statement at the end of the statement list following every case label, if you want to exit the switch construct after the statements within a selected case are executed.
The switch Statement
The switch Statement
Nested if Statements
Nested if Statements
As you saw in the previous sections, one if statement enables a program to make one decision. In many cases, a program has to make a series of decisions. To enable it to do so, you can use nested if statements.
The if-else Statement
The if-else Statement