+ 1
Explain the code
Can't get it
7 Answers
+ 1
unsigned int i=23;
signed char c=-23;
if(i>c)
printf("yes");
else
Printf("No");
0
Output is No
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