initalization Query !

Bhullarz's Avatar
Skilled contributor
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.
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Read about the comma operator and it will become clear to you
0
Bhullarz's Avatar
Skilled contributor
Thank you. I wasn't aware of this operator.