TCS
Company
Programming
Arrays
Predict the output of following code:
main()
{
int a=2;
if(a-- , --a, a) // if(2, 0, 0) last value 0 →False
printf(“Tom”);
else
printf(“Jerry”);
}
1. Tom
2. Jerry
3. Tom Jerry
4. Error
Read Solution (Total 6)
-
- Output is jerry
- 6 years agoHelpfull: Yes(9) No(0)
- Jerry as gives 2,0,0 last value zero
- 4 years agoHelpfull: Yes(2) No(0)
- 2
"Jerry "is correct answer - 6 years agoHelpfull: Yes(0) No(1)
- Jerry is the correct answer
- 6 years agoHelpfull: Yes(0) No(1)
- please explain
- 6 years agoHelpfull: Yes(0) No(2)
- it prints jerry
- 4 years agoHelpfull: Yes(0) No(1)
TCS Other Question