0 0 votes void main( ) { int a=0,b=2; if(a++, b--, --b) printf(“%d %d”, a, b); else printf(“%d %d”, b, a); } "In the middle of difficulty lies opportunity." Programming in C programming-in-c output + – Desert_Warrior 912 views answer comment Share Follow Print 0 reply Please log in or register to add a comment.
Best answer 4 4 votes Comma operator returns the value of the rightmost operand when multiple comma operators are used inside an expression. i = (1,2,3); will return 3 to i. Now consider the program if(a++, b--, --b) Here final value returned will value of b which will be zero condition become false so else part will executed . Output:0,1 ManojK answered Jun 14, 2016 • selected Jun 14, 2016 by Desert_Warrior ManojK comment Share Follow See all 2 Comments 2 2 Comments reply shekhar chauhan commented Jul 16, 2016 reply Follow flag @Manojk i did not understand this line Here final value returned will value of b which will be zero condition become false so else part will executed . can you explain which condition is becoming false here. 0 0 replyShare ManojK commented Jul 16, 2016 reply Follow flag if(1,0,0) i am talking here about if statement . 0 0 replyShare Please log in or register to add a comment.