Output of C Program | Set 19
Predict the outputs of following program.
Difficulty Level: Rookie
Question 1
#include <stdio.h> int main() { int a = 10, b = 20, c = 30; if (c > b > a) { printf("TRUE"); } else { printf("FALSE"); } getchar(); return 0; } |
chevron_right
filter_none
Output: FALSE
Let us consider the condition inside the if statement. Since there are two greater than (>) operators in expression “c > b > a”, associativity of > is considered. Associativity of > is left to right. So, expression c > b > a is evaluated as ( (c > b) > a ) which is false.
Please write comments if you find any of the answers/explanations incorrect, or you want to share more information about the topics discussed above
Recommended Posts:
- Output of C++ Program | Set 19
- Output of C++ Program | Set 20
- Output of C Program | Set 24
- Output of C program | Set 25
- Output of C Program | Set 26
- Output of C++ Program | Set 11
- Output of C++ Program | Set 12
- Output of C Program | Set 27
- Output of C++ Program | Set 13
- Output of C++ Program | Set 14
- Output of C++ Program | Set 15
- Output of C++ Program | Set 16
- Output of C++ Program | Set 17
- Output of C++ Program | Set 8
- Output of C Program | Set 22



