Conditional Compilation #if #elif #endif
//**conditional compilation**
//we use # before if because it is a macro defination program
//and we use #endif to end the #if statement
//their is no need of pare of parenthesis in if statement bcoz it work on macro
#include <stdio.h>
#include <stdlib.h>
#define INDIA 1
#define PAKISTAN 2
#define USA 3
#define ISRAIL 4
#define COUNTRY INDIA
#define AGE 19
int main()
{
printf("code for the universe\n");
#if COUNTRY == INDIA
printf("code for the indians\n");
#if AGE >= 18
printf("you are eligible for this code\n");
#endif
#elif COUNTRY == USA
printf("code for the USA\n");
#if AGE >= 18
printf("you are eligible for this code\n");
#endif
#elif COUNTRY == PAK
printf("code for the pak\n");
#if AGE >= 18
printf("you are eligible for this code\n");
#endif
#else
printf(" code for other country except india usa and pak\n");
#endif
return 0;
}
Comments
Post a Comment