C | Operators | Question 11
#include <stdio.h> int main() { int a = 10, b = 20, c = 30; if (c > b > a) printf("TRUE"); else printf("FALSE"); return 0; } |
chevron_right
filter_none
(A) TRUE
(B) FALSE
(C) Compiler Error
(D) Output is compiler dependent
Answer: (B)
Explanation: 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.
Recommended Posts:
- Operators in C | Set 2 (Relational and Logical Operators)
- C | Operators | Question 27
- C | Operators | Question 26
- C | Operators | Question 18
- C | Operators | Question 17
- C | Operators | Question 15
- C | Operators | Question 13
- C | Operators | Question 21
- C | Operators | Question 22
- C | Operators | Question 27
- C | Operators | Question 27
- C | Operators | Question 26
- C | Operators | Question 24
- C | Operators | Question 23
- C | Operators | Question 12



