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

How can beauty exist in the midst of brutality?
While doing research for a paper, you are able to find one article that you think is trustworthy. According to SIFT, after investigating the article, what shoul
list two examples of lazzi
find the exponential nation of 3125
1. I am a group of 3 digits separated by commas in a multidigit nuber​
A student winds a strip of paper eight times round a cylinderical pencil of diameter 7mm. Use the value 22/7 for the to find the length of the paper( ignore the
The daily high temperatures, in degrees Celsius, for two weeks were recorded. The first week had a mean high temperature of 8 degrees Celsius and a mean absolut
genghis kan’s conquest led to the rise of tang empire true or false
Which algebraic expression is a difference with two terms? O A. 6(x+5) OB. 6 + x-9 O C. 6x - 9 O D. 9x6
In the early and mid-1800s, much of the Southern economy depended on