initalization Query !

Skilled contributor
7Apr2008,14:50   #1
Bhullarz's Avatar
Code:
#include<stdio.h>
int main()
{
int i=(2,3);
printf("%d",i);
}
output of the program would be:
Code:
 3
i don't understand why it is 3 as far as i know one variable can be assigned one value at one time,but here we are assigning 2 values,but still this program is error/warning free and giving output.

kindly explain the reason.
Go4Expert Founder
7Apr2008,15:01   #2
shabbir's Avatar
Read about the comma operator and it will become clear to you
Skilled contributor
7Apr2008,18:11   #3
Bhullarz's Avatar
Thank you. I wasn't aware of this operator.