Same code….Different output….

Friends,
Try the following code in truboc and devc++ editor (gcc compiler).

int i=5;
printf("%d",i++ - i++ - --i - i--);
and
int i=5,n;
n=i++ - i++ - --i - i--;
printf("%d",n);

As we expect, the  answer should be same.
But it is different in both the compilers…..Why??? Please let me know if you knew this.

2 comments to Same code….Different output….

  • I tried two methods into gcc i got -8 as an output

    Can you please send the output of turboc compiler [ i think that this conflit may be the use of post increment operator ]

  • This is the problem of turboc compiler , first method its giving -13 as a output, second -8. The problem of turboc compiler is stack manipulation ….

    Always GCC rocks …….

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">

Spam protection by WP Captcha-Free