I am having some trouble figuring out why this code is showing different results in linux and windows:
#include <stdio.h>
int main()
{
int x=2;
x = 4 * x++;
printf("%d\n", x);
return 0;
}
In linux it is showing 8
(which is logically correct I think). In windows it is showing 9
. Is it because the increment is done after the statement is finished executed rather than when evaluating? The same thing happens for pre-increments.
NB: In linux I am using gcc, in windows I am using mingw (codeblocks).