+1

Explain the code

Can't get it

c

3/30/2020 5:29:40 PM

Ajith

7 Answers

New Answer

+1

unsigned int i=23; signed char c=-23; if(i>c) printf("yes"); else Printf("No");

0

Output is No

0

Well apart from the fact that your code has no guards and a syntax error it's to do with automatic conversion of numbers and a comparison. It should read... unsigned int i=23; signed char c=-23; if(i>c){ printf("yes"); }else{ printf("No"); } I can see from your profile that you have completed the C course so this is not new to you. If you need further details see... Relational and comparison operators http://www.cplusplus.com/doc/tutorial/operators/ Selection statements: if and else http://www.cplusplus.com/doc/tutorial/control/ Fundamental data types http://www.cplusplus.com/doc/tutorial/variables/

0

Oh okie

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.

0

Thanks

0

Hope u got it