Please explain the comma operator in this program

The , operator evaluates a series of expressions and returns the value of the last.

c=a,b is the same as (c=a),b. That is why c is 10

c=(a,b) will assign the result of a,b, which is 20, to c.

As Mike points out in the comments, assignment (=) has higher precedence than comma

Leave a Comment