+ 8

[SOLVED]Explain the output?

Why the code gives output no instead of yes. Why unsigned and signed makes difference https://code.sololearn.com/c83m2NYwj8Pv/?ref=app

13th Mar 2019, 2:11 PM
🇮🇳Omkar🕉
🇮🇳Omkar🕉 - avatar
5 Respuestas
+ 14
Omkar Jadhav because -20 made unsigned is 4294967276 so much larger than 24. Mixing signed and unsigned always results in auto conversion to unsigned.
13th Mar 2019, 3:02 PM
John Wells
John Wells - avatar
+ 6
John Wells sir maybe you can answer my question
13th Mar 2019, 2:12 PM
🇮🇳Omkar🕉
🇮🇳Omkar🕉 - avatar
+ 5
Yes the signed integer is implicitly cast to an unsigned (large positive number) during the comparison with an unsigned integer.
14th Mar 2019, 3:26 AM
Sonic
Sonic - avatar
0
If we mixed signed and unsigned int in the program then it can create issues because as per the c standard if we perform the arithmetic operation on signed and unsigned number then the resultant value can be implementation dependent or undefined in some scenarios. In C99, integer promotion is clearly defined that If an int can represent all values of the original type, the value is converted to an int, otherwise, it is converted to an unsigned int. 
17th Mar 2019, 10:37 AM
vishal dasani
vishal dasani - avatar