--- In [email protected], Paul Herring <pauljherr...@...> wrote:
>
> On Fri, Jul 10, 2009 at 6:28 AM, mohit_dreamer<mohit.itm...@...> wrote:
> > #include<stdio.h>
> > #include<conio.h>
> > #define PRODUCT(x) (x*x)
> > void main()
> > {
> > int i=3,j,k,l;
> > clrscr();
> > j=PRODUCT(i+1);
> 
> Expands to:
> j = (i+1*i+1);
> 
> Which is equivalent to
> j = (i+(1*i)+1);
> 
> > printf("%d",j);
> > k=PRODUCT(i++);
> 
> Expands to:
> k = (i++*i++);
> Which is undefined behaviour. See http://c-faq.com/expr/evalorder2.html
> 
> > printf("\n%d",k);
> > l=PRODUCT(++i);
> 
> Same effects as k - undefined behaviour.
> 
> > printf("\n%d",l);
> > getch();
> > }
> > output:
> > 7
> > 9
> > 49
> > can u plz expln the output...??
> >
> > any help will be thankful.
> >
> > thanx.
> 
> -- 
> PJH
> 
> http://shabbleland.myminicity.com/com
> http://www.chavgangs.com/register.php?referer=9375
>
FYI

Reply via email to