Discussion :: Operators and Expressions
-
Identify the correct output of the following code:
void main()
{
int w=10, x=5, y=3, z=3;
if( (w < x ) && (y=z++) )
printf("%d %d %d %d", w, x, y, z);
else
printf("%d %d %d %d", w, x, y, z);
}
Answer : Option B
Explanation :
As the first condition ( w < x) is false and the logical operator && is used, the entire relation becomes false and the second part ( y = z++) is not executed.
Be The First To Comment