According to the C++ standard regarding the comma operator
Every value computation and side effect associated with the left expression is sequenced before every value computation and side effect associated with the right expression. |
So in the statement
y = (x++, printf("x = %d\n", x), ++x, printf("x = %d\n", x), x++);
the sequence of actions is the following
1) x++
2) the side effect is sequenced x == 11
3) printf("x = %d\n", x) - outputs x == 11
4) ++x x == 12
5) printf("x = %d\n", x) outputs x == 12
6) x++ The value of the expression is 12
7) y = 12
8) the side effect is sequenced after the full expression; x == 13
After that you print values of y and x that is 12 and 13.
printf("y = %d\n", y);
printf("x = %d\n", x);