Mega Code Archive

 
Categories / C Tutorial / Preprocessor
 

MACRO AND FUNCTION

Macro just indicates replacement, not the function call. #include <stdio.h> #define add(x1, y1)  x1 + y1 #define mult(x1,y1)  x1 * y1 main () {     int a,b,c,d,e;     a = 2;     b = 3;     c = 4;     d = 5;     e = mult(add(a, b), add(c, d));     // mult(a+b, c+d)     // a+b * c+d     printf ("The value of e is %d\n", e); } The value of e is 19