C language #if, #elif, #else, #endif Pre-processor - Pre-processor Directives in C



 c language if elif else endif pre processor

Learn C - C tutorial - c language if elif else endif pre processor - C examples - C programs

C language #if, #elif, #else, #endif Pre-processor

  • Every C program should pass through a Pre-processor before compilation.
  • The preprocessor is a part of the compiler which performs preliminary operations to your code before the compiler.
 c language if elif else endif pre processor

Learn C - C tutorial - c language if elif else endif pre processor - C examples - C programs

Sample Code

#include <stdio.h>
#define ENG_US	1
#define ENG_UK	2
#define FRENCH	3
#define LANGUAGE ENG_UK
int main()
{
#if LANGUAGE==ENG_US
printf("Selected language is: ENG_US\n");
#elif LANGUAGE==ENG_UK
printf("Selected language is: ENG_UK\n");
#else 
printf("Selected language is: FRENCH\n");
#endif
return 0;
}

Output

Selected language is: ENG_UK


View More Quick Examples


Related Searches to C language #if, #elif, #else, #endif Pre-processor - Pre-processor Directives in C