C Programming/Preprocessor reference

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Preprocessor Reference[edit]

The following preprocessor statements exist:

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

Some nonstandard compilers also specify #warning and #import.