C Pre-processor - C language #ifdef, #else, #endif Pre-processor
Learn C - C tutorial - c language #ifdef #else #endif pre-processor - C examples - C programs
C language #ifdef, #else, #endif Pre-processor
Directives
- The directives #ifdef, #else, and #endif are pre-processor directives which are used to specify which code will be compiled by the compiler based on defined macros.
Learn C - C tutorial - c language #ifdef #else #endif pre-processor - C examples - C programs
Sample Code
#include <stdio.h>
#define DEBUG 1
int main()
{
#ifdef DEBUG
printf("Debug is ON\n");
printf("wikitechy\n");
#else
printf("Debug is OFF\n");
#endif
return 0;
}
Output
Debug is ON
wikitechy