Re: Macros



1. will throw comile error,
why ?

2. macro will not add any '(' or ')' macro will blindly replace the
string.
x+2 * y- 10
= x + (2*Y) -10
=...do it urself



--raxit sheth


Harry wrote:
Hi all,Nice Day to you


I have a piece of code as

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

will the macro be evaluated as (2+2)*(3-10)=4* -7 =-28.

I executed this code,but this o/p is not coming.
What is the reason?

Is it that expressions should not be passed as arguments to macro
functions...

can anyone help me out...

thanks in advance.

.



Relevant Pages