main() { int x=20,y=35; printf("1:%d%d\n",x,y); x=y++ + x++; //This operation is not working printf("2:%d%d\n",x,y); y= ++y + ++x; printf("3:%d%d\n",x,y); } If you compile the following program it gives following output. gcc(3.3.2) - Wrong output ------------ 1:2035 2:2136 3:2259 Ideal output should be ---------------------- 1:2035 2:5636 3:5794
This is not a bug in the compiler, but in your code. Your code triggers undefined behavior because there's no sequence point in "x=y++ + x++". An even shorter example would be "x=x++". *** This bug has been marked as a duplicate of 11751 ***