Ask Question
13 October, 00:15

What is the result of expression 15 > 10 > 5 in C? What is the result of the same expression in Java?

+5
Answers (1)
  1. 13 October, 01:08
    0
    java: error

    C: false

    Explanation:

    In Java the compiler understand that you are trying to compare an integer (15) with a boolean (10 > 5) this generate the next error:

    error: bad operand types for binary operator

    In C the compiler convert (15 > 10 > 5) in (15>10) > (10>5) which is equal to TRUE > TRUE, the compiler can also read it as 1 > 1 (since 1 is TRUE and 0 is FALSE). like 1>1 is false then C program return false.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “What is the result of expression 15 > 10 > 5 in C? What is the result of the same expression in Java? ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers