elif in c

#else and #elif in c

#else is used with the #if preprocessor directive. It is like if-else control structure. The syntax is as-

#if constant-expression
statements
……….

#else
statements
……….

#endif

if the constant expression is true(non zero) then the statements between #if and #else are compiled otherwise the statements between #else and #endlif are compiled lets take the example to understand #else directive

/* program to understand the use of #else directive */
#include<stdio.h>
#define
COUNT 10
int main()
{
int a=15,b=6;
#if COUNT>8
printf("COUNT is gratter then 10\n");
a=a-b;
b=a+b;
#else
printf("Value of COUNT value is less then 8 \n ");
a=a*b;
#endif
printf("a=%d and b=%d \n",a,b);
return 0;
}

output:
COUNT is gratter then 10
a=9 and b=21