0 votes 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 asked Jun 14, 2016 Desert_Warrior 579 views answer comment Share Follow See all 0 reply Please log in or register to add a comment.
Best answer 4 votes 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 See all 2 2 Comments reply shekhar chauhan commented Jul 16, 2016 reply Follow Share @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 votes 0 votes ManojK commented Jul 16, 2016 reply Follow Share if(1,0,0) i am talking here about if statement . 0 votes 0 votes Please log in or register to add a comment.