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

what is 72:75 as as fraction
A normal appearing couple is found to be heterozygous recessive for albinism. Both have the genotype Aa. The gene responsible for albinism is recessive to the n
How were the independence movements in Vietnam and Kenya similar? Both nations achieved independence from British rule. Both movements involved violent conflict
six friends share 4 pears
How do you know whether a number is a multiple of another number
Gentry poured 23.5 ounces of milk and 7.75 ounces of cream in a mixing bowl. How much more cream could Gentry add to the bowl if the capacity of the bowl is 35.
PLEASE HELP I GIVE THANKS
What was a common problem in feudal society that the Church tried to stop during holy days and seasons?.
Glycolysis is a body process which involves: a.the passage of water through a semipermeable membrane b.the division of the nucleus of a body cell c.the maintena
What did Adam Smith say should determine the cost of goods?