O'Reilly logo

C Programming: Visual Quickstart Guide by Marc Liyanage, Larry Ullman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating Conditionals

Just as you can have conditionals within your C code that may or may not execute code depending on whether a condition is true or false, you can write C preprocessor conditionals. These are directives that instruct the preprocessor to do something (or not do something) based on certain criteria. Unlike your C conditionals, which are checked during execution of an application, C preprocessor conditionals are tested during the preprocessor stage (just before compilation).

There are a number of conditional directives in the C preprocessor (Table 8.1), allowing for relatively intricate examples.

Table 8.1. These directives are used to create conditionals for the C preprocessor.
Conditional Directives
DirectiveEffect
#ifIncludes ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required