#include<stdio.h>
int main()
{
int x=2;
x=x++;
printf("%d",x);
return 0;
}
Output according to my logic : 2
Output on windows : 3
Output on Linux: 2
Why is windows giving 3 as output. From what I understand x++ increments 2 to 3 but return back 2. So x should have 2.Is windows evaluating this anything different.
Similarly:
#include<stdio.h>
int main()
{
int x=2,y=4;
x=x++ + ++y;
printf("%d %d",x,y);
return 0;
}
Output according to me : 7 5
Output in windows : 8 5
Output on Linux : 7 5
Again the same situation.
Please help.....