C – Comma Operator

Home/C - Tutorial/C - Operators/C – Comma Operator
C – Comma Operator 2017-06-12T10:11:00+00:00

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;

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 :

Output :


i = 30

j = 10

Prev Next