What does the comma operator , do?

lillq picture lillq · Sep 9, 2008 · Viewed 40.6k times · Source

What does the , operator do in C?

Answer

lillq picture lillq · Sep 9, 2008

The expression:

(expression1,  expression2)

First expression1 is evaluated, then expression2 is evaluated, and the value of expression2 is returned for the whole expression.