Ask Question

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

+3
Answers (1)
  1. 23 June, 03:53
    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?
Find 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 the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers