< C Programming

Preprocessor Reference

The following preprocessor statements exist:

Statement Subsequent items on the control line Meaning
========= ==================================== =======
#if       conditional-expression               conditional
#ifdef    identifier                           true iff identifier is a macro
#ifndef   identifier                           true iff identifier is not a macro
#elif     conditional-expression               continues a conditional
#else                                          continues a conditional
#endif                                         ends a conditional
#include  header-name                          includes a file
#define   identifier                           defines a macro
#undef    identifier                           removes a previously defined macro
#line     number filename                      changes the line number and file name
#error    token-list                           specifies an error
#pragma   token-list                           catchall

Some nonstandard compilers also specify #warning and #import.

A conditional-expression above can include the defined operator.

The #define indentifier above can be followed by an optional list of parameters and then an optional list of replacement tokens. The left parenthesis of the parameter list must have no preceding white space.

This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.