Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   The macro functions (http://www.go4expert.com/forums/the-macro-functions-t24715/)

shubhadajs 24Jan2011 17:59

The macro functions
 
Dear all
I have a doubt regarding the macro function.


#define SQR(x) (x*x)
main()
{
int a,b=3;
a= SQR(b+2);
printf("%d",a);
}

The above program gives output as 11.
And if I pass SQR(b+3), it gives o/p 15.

How?

shabbir 24Jan2011 18:50

Re: The macro functions
 
3+2*3+2 is what you are getting when you expand the macro


All times are GMT +5.5. The time now is 08:27.