C Language: #endif Directive
This C tutorial explains how to use the #endif preprocessor directive in the C language.
Description
In the C Programming Language, the #endif directive closes off the following directives: #if, #ifdef, or #ifndef. When the #endif directive is encountered, preprocessing of the opening directive (#if, #ifdef, or #ifndef) is completed.
Syntax
The syntax for the #endif directive in the C language is:
#endif
Example
The following example shows how to use the #endif directive in the C language:
/* Example using #endif directive by TechOnTheNet.com */ #include <stdio.h> #define WINDOWS 1 int main() { printf("TechOnTheNet is a great "); #if WINDOWS printf("Windows "); #endif printf("resource.\n"); return 0; }
Here is the output of the executable program:
TechOnTheNet is a great Windows resource.
Advertisements