Question #53470

#include<stdio.h>
int main()
{
int k=35;
printf("\n %d %d %d",k==35,k=50,k>40);
return 0;
}
please explain the logic behind this program very clearly sir and give the output

Expert's answer

Solve
Output:

0 50 0
Explain:
Output executing from right to left
Since 35<40, we have false value and as integer this expression have value 0
In printf exist assignment to k, it execute first. So, at printf value of k is 50.
Since k=50, second output – is output k, so, we have 50
Since 50≠35, we have false value and as integer this is expression have value 0

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS