--- In [email protected], "johnmatthews2000" <jm5...@...> wrote:
>
> --- In [email protected], Sandip Tujare <sandip_tujare@> wrote:
> >
> > Answer of this program is 14 because here order of evaluation of the 
> > statement is right to left.
> 
> No it isn't - see previous replies. Well I hope it isn't, or gcc is broken; 
> see below, especially the answer at the bottom:
> 
> 9

Or modify the code slightly - make m a global instead of local - and I get 
another answer. But this is ok because the result is undefined.

#include<stdio.h>
//#include<conio.h>
int m=1;
int main(void)
{
  m=m++ + m++ + ++m + ++m;
  printf("%d\n", m);
  //getch();
  return 0;
}

[jo...@wey ~]$ a.out
2

Reply via email to