C Programming Language

Comma operator

                  A set of expression separated by comma is a valid constant in the C language. For example i and j are declared by the statements

int i , j;
i=(j=10,j+20);

                In the above declaration, right hand side consists of two expressions separated by comma. The first expression is j=10 and second is j+20. These expressions are evaluated from left to right. ie first the value 10 is assigned to j and then expression j+20 is evaluated so the final value of i will be 30.

Example:

Comma Operator
Conditional operators Home Unary operators

c program stats