In this expression
(b,a)
there is the comma operator. Its value is the value of the last (right) subexpression after the comma. The value of the first (left) subexpression is discarded. So the output will be
6
From the C++ Standard
A pair of expressions separated by a comma is evaluated left-to-right;
the left expression is a discardedvalue expression (Clause 5).87 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. The type and value of the result are the
type and value of the right operand; the result is of the same value
category as its right operand, and is a bit-field if its right operand
is a glvalue and a bit-field. If the value of the right operand is a
temporary (12.2), the result is that temporary.
solved Operator in C/C++ [closed]