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

Which is the adverb phrase in the sentence? During the night, he heard animals in the woods by the campground and had trouble sleeping. A. During the night
what is another way to write 4 hundreds
Facility that provides nursing care for residents who have many or severe health problems
Paul will pay for his new car in 36 monthly payments.if his car loan is for $19,061,then about how much paul will pat each month? Round your answer to the neare
As a result of the Treaty of Paris (1763) who gained control of Canada and Florida? A.)Spain B.)France C.)United States D.)Great Britain
How do Locke’s philosophies relate to a person’s role in her government?
multiple (8+3i)(3+5i)
if an offer is rejected, should the offeree have the right to negotiate before the offer is considered terminated
Consider the images in the excerpt. Which of the five senses do the images appeal to?
Simplify 5x - 7x - 8x +4