Saturday, February 13, 2010

14

#include< stdio.h >
#define a (5+2)
main()
{
int c;
c=2*a;
printf("%d",c);
}


Output


14


how?


as said in last post the variable defined using macro is replaced with that constant.
Here c=2*a; will become as c=2*(5+2);
'()' has higher precedence than the '*' so, 5+2 will be added and multiplied to 2.i.e
b=2*7=14;

0 comments:

Post a Comment