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

Find the area. Simplify your answer.
which of the following best completes the diagram above?
What is 2 divided by 192? ​
The figure shows a circle inscribed in a square. The area of the square is 144 square inches. What is the area of the circle, to the nearest square inch? Use 3.
how do i solve using distributive property ? 10 (9-m)
(blank) do not have definite shape or volume
Please HELP!! Place the events 1 to 7 in order of how they happen during speciation.
which region of Australia is most important for farming and sheep herding?
Please answer soon!! (Select all 3 that apply)
Which of the following rational numbers is equal to 1.6 ? (1 point) 22/9 , 24/9 , 26/9 , 28/9 Group of answer choices 22/9 , 24/9 , 26/9 , 28/9