+ 1
#include<stdio.h> void main() { int count=0?2:0?3:4?5:6?1:9; printf("%d", count); }
I want to know about how the answer came 5?
2 Answers
+ 8
0?2:0?3:4?5:6?1:9
is something like
if (0) {
return 2;
}
else {
if (0) {
return 3;
}
else {
if (4) {
return 5;
}
else {
if (6) {
return 1;
}
else {
return 9;
}
}
}
}
Trace it and you'll get 5.