Explain the code | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Explain the code

Can't get it

30th Mar 2020, 5:29 PM
Ajith
Ajith - avatar
6 Answers
+ 1
unsigned int i=23; signed char c=-23; if(i>c) printf("yes"); else Printf("No");
30th Mar 2020, 5:30 PM
Ajith
Ajith - avatar
0
Output is No
30th Mar 2020, 5:31 PM
Ajith
Ajith - avatar
0
Oh okie
31st Mar 2020, 8:32 AM
Ajith
Ajith - avatar
0
Ajith u are comparing signed char with unsigned int The concept is if both operands have same type then no conversion will occur bt if ur unsigned int operand type of rank greater than or equal to the other operand then the signed operand is converted to the type of unsigned int operand U can check this by this code #include<stdio.h> int main() { Unsigned int i=23; Signed char j=-23; If(i>j) printf ("yes"); else Printf("no\n"); Printf ("%u",(unsigned int)y); return 0; } and if u have more than one statement to execute then only u need to apply braces after if() otherwise it is not necessary to apply braces if() will read 1 line by itself and after that it will terminate.
1st Apr 2020, 11:22 AM
Abhishek Shukla
0
Thanks
1st Apr 2020, 11:32 AM
Ajith
Ajith - avatar
0
Hope u got it
1st Apr 2020, 11:34 AM
Abhishek Shukla