Friday, February 12, 2010

13

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


click Output


How?


#define is used to define a constant.
in this program 3+2 is defined for 'a'.
so whenever you use a variable,it'll replace the a with 3+2.

b=a*2; in this expression a is replaced by 3+2 while creating expanded code.
so it'll become like this b=3+2*2;

we know that '*' has high precedence than +.
2*2 will multiplied and it'll added to 3.
so b=7.

0 comments:

Post a Comment