Comma Operator:  ,

expression :

assignment-expression
expression **,**assignment-expression

The comma operator, also called the “sequential-evaluation” operator, evaluates its two operands sequentially from left to right.

The left operand of the comma operator is evaluated as a void expression. The result of the operation has the same value and type as the right operand. Each operand can be of any type. The comma operator does not perform type conversions between its operands, and it does not yield an l-value. There is a sequence point after the first operand, which means all side effects from the evaluation of the left operand are completed before beginning evaluation of the right operand.

The comma operator is typically used to evaluate two or more expressions in contexts where only one expression is allowed.

Commas can be used as separators in some contexts. However, you must be careful not to confuse the use of the comma as a separator with its use as an operator; the two uses are completely different.

Example

In the following example, the function AnyFunction has three arguments, with the second argument resolving to a value of 3.

// Example of the comma operator
AnyFunction(a, (b=1, b+2), c);