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

(5+5x)-(1-3x) simplify please and thank you
● Describe the historical context surrounding these documents ● Identify and explain the relationship between the events and/or ideas found in these document
What is a goal of a common community health program?
help now please :(What do you notice about China's Climate and Geography?
With which organization was John Lewis (seen here) MOST associated as a leader?
What does political opinion mean
Compared with the US Constitution, how difficult is it to amend state constitutions? A. The US Constitution is easier to amend. B. Each is difficult to amend.
In the context of this text, what are the effects of racism? How does racism emerge?
what is the quadratic formula of y=x2 – 8x + 13​
The solid was created by connecting two congruent square pyramids to a rectangular prism. A rectangular prism with a length of 14 inches, width of 15 inches,