Tuesday, March 29, 2016

Macros



Using Macros to Define used constants to improve readability and maintainability.


Example : 



 1
 2
 3
 4
 5
 6
 7
 8
 9
10
#include <stdio.h>
#define add(x,y) ((x)+(y))

int main()
{
    int i=5, j =7 , result=0;
    result=add(i,j);
    printf("the additional result = %d",result);
    return 0;
}


Share this

0 Comment to "Macros"

Post a Comment