Read: Comma Operator: ,
The comma operator , has left-to-right associativity. Two expressions
separated by a comma are evaluated left to right. The left operand is
always evaluated, and all side effects are completed before the right
operand is evaluated.
The expression:
i = (j + 2, j + 3, j++);
is in effects equivalent to (because evaluation of j + 2 and j + 3 has no side-effects):
i = j++;
So first value of j is assigned to i that is 1 then j incremented to 2.
Here j + 2 and j + 3 are evaluated before j++ but it has no effect.
Important to note parenthesis ( ) in expression over write the precedence so first , operator evaluated within parenthesis and then = evaluates at last.
To understand the output: look at precedence table , have lower precedence than =. In you expression you have overwrite the precedence using parenthesis.
Edit: on the basis of comments:
Suppose if expression is:
int i = (j++, j+2, j+3);
In this expression j++ first increase value of j because of ++ operation to 2 then j + 2 evaluates but this sub-expression has no side effects finally j + 3 evaluates = 5 and 5 is assigned to i. so value to i at the end is 5.
Check working code
So here int i =(j++, j+2, j+3); is NOT equivalent to just i = j + 3 because j++ has side effect that change value of j.
In sort if you have an expression like a = (b, c, d) then first expression b evaluates then expression c evaluates then expression d evaluates due to left-to-write associativity of , operator then final value of expression d is assigned to variable a.