Ask Question
1 September, 06:33

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

+2
Answers (1)
  1. 1 September, 08:02
    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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers