C Pre-processor - C language #ifdef, #else, #endif 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.
 c language #ifdef  #else #endif pre-processor

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


View More Quick Examples


Related Searches to C Pre-processor - C language #ifdef, #else, #endif Pre-processor