c - Please Explain Comma Operator in this Program -
c - Please Explain Comma Operator in this Program -
please explain me output of program:
int main() { int a,b,c,d; a=10; b=20; c=a,b; d=(a,b); printf("\nc= %d",c); printf("\nd= %d",d); }
the output getting is:
c= 10 d= 20
my uncertainty "," operator here? compiled , ran programme using code blocks.
the ,
operator evaluates series of expressions , returns value of last.
c=a,b
same (c=a),b
. why c 10
c=(a,b)
assign result of a,b
, 20, c
.
as mike points out in comments, assignment (=
) has higher precedence comma
c comma
Comments
Post a Comment