liyaahbear2068 liyaahbear2068
  • 02-09-2019
  • Computers and Technology
contestada

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

Respuesta :

oscarporras02
oscarporras02 oscarporras02
  • 07-09-2019

Answer:

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.

Answer Link

Otras preguntas

Victims of terror attacks are typically high profile leaders in opposition to terrorist agendas. True False
How does carbon dioxide in the atmostphere enter into living organism?
What was the main destination of the trail of tears?
Which of these contributed most to white settlers' desire to have the seminole tribe removed from florida? a.seminole attacks on small farmsb.a seminole allianc
How could you test to see if an enzyme was completely depleted during an experiment?
Which reaction leads to the formation of a precipitate? 2Cr(NO3)3(aq) + 3FeSO4(aq) → 2RbF(aq) + CuSO4(aq) → 2Ca(OH)2(aq) + 2FeCl3(aq) →
what is the main purpose of Admission Point Score
What did ancient india create in response to flooding?
Your auto insurance policy has a $200 monthly premium and $700 deductible. what is the maximum amount you will have to pay out of pocket for a car accident befo
what are the advantages and disadvantages of a stakeholder