Consider the follow C code int x 1 unsigned y 0 if x Solut

Consider the follow C code: int x = -1; unsigned y = 0; if (x

Solution

Here the Binary operations such as comparisons between different integral \"common\" type is unsigned int.
Hence in your program int operand x will be converted to unsigned int before the comparison and -1 is the largest possible unsigned int.

So when you are comparing x with y the condition is false and it is not printing anything.
Anything written on else part will be executed in this case whereas in your program else part is not written hence it is not printing anything.

 Consider the follow C code: int x = -1; unsigned y = 0; if (x SolutionHere the Binary operations such as comparisons between different integral \

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site