399 views

1 Answer

1 votes
1 votes

Consider the Line in program

 if( b>a, a>b)

Here b>a will evaluated false  and a>b will evaluated true

So conditional statement becomes

 if( 0, 1)
In the C and C++ programming languages, the comma operator (represented by the token ,) 
is a binary operator that evaluates its first operand and discards the result, 
and then evaluates the second operand and returns this value (and type).

Note:Comma operator returns the value of the rightmost operand when multiple comma operators are used .

So it will return 1 to if statement as condition a>b will evaluated true so if statement will be executed  return printf(“%d”,--b); value.

,Here b=1

So output:0

edited by

Related questions