Wednesday 27 February 2013

preprocessor define directive



/* C program to show preprocessor directive # define */



/* # define gives a name to constant value before program compilation */


# include <stdio.h>
# define A(i,j) i+j     // i+j will be inserted where we will find A(i.j)

int main()
{
   int x = 100;
   int y = 210;

  // i+j will get inserted here
   printf("%d \n", A(x, y));
   return 0;
}


Output
310



No comments:

Post a Comment