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

Can an ectopic pregnancy be detected by a pregnancy test.
2 hours 37 minutes before 3:27 p.m?​
The nurse would predict what physiological effects of the client's pain? (select all that apply. One, some, or all options may be correct. ).
Does the graph represent a function? y 1 6 5+ 4+ 3+ 2 1+ +++ -7 -6 -5 -4 -3 -2 tot 2 1 2 3 4 5 6 7 -2+ -3 -4+ -5- -67 -7 Choose 1 answer: Yes No​
Read the paragraph. then answer the questions.​
what percent of 570 kg is 190 kg The answer is this​
Help I need help what is the answer
10) How many total atoms (N + H) are in one mole of ammonia (NH3) molecules? A) 6.0x10^23 B) 1.2x10^24 C) 1.8x10^24 9 D) 2.4x10^24
What is the slope of the line
Find the volume of the solid obtained by rotating the region bounded by y=4x and y=2sqrt(x) about the line x=6.