Procecessor Directives : #if

The #if Conditional Compilation Directive allow us to include certain portion of the code depending upon the output of constant expression. It basically evaluates the expression or condition. If condition is true it executes the instruction.

Syntax :
 #if Expression
   // statement to execute
Example :
#include <stdio.h>

#define NUM 20

int main() {

#if (NUM%2 == 0)
  printf("%d is even number.\n", NUM);

  return 0;
Output :

20 is even number.

Next : C Language Tutorials List