The comma operation is a relatively small operation.
The form of a comma expression is as follows:
Expression 1, expression 2, expression 3,..., expression n
Essentials of a comma expression:
(1) The comma expression is calculated from left to right. That is, its entire value is the value of the last expression.
(2) The comma expression is used as a whole, and its value is the value of the last expression (that is, expression n.
(3) The priority of the comma operator is not the lowest among all operators.
Example:
I = (a = 2*3, a * 5), a + 6;
Result: I = 30
Analysis:
A = 2*3, a * 5 is a comma expression, and the calculated value is 30. I = (a = 2*3, a * 5) constitute an assignment statement, the value assignment statement and a + 6 constitute a comma statement.
Similarly, you can analyze the following results ~
I = (a = 2*3, a * 5), a + 6 );
Result: I = 12