int main()
{
unsigned x = 1;
signed char y = -1;
if ( x > y )
printf(" x > y " );
else
printf(" x <= y ");
getch();
return 0;
}
I was required to find the output of some code so I built the above code, but the code I was required to print the output of was mainly
unsigned x = 1;
signed char y = -1;
if ( x > y )
printf(" x > y " );
else
printf(" x <= y ");
I got the output as x <= y but yet haven't understood the concept of unsigned and signed char. Self study is a bit tricky :S
-----------------------------------------------------------------------------------------------------------------
Edit: I have another doubt related to the following piece of code:
int main()
{
int x = 10;
if ( x = 20 )
printf(" TRUE " );
else
printf(" FALSE ");
return 0;
getch();
}
Why does the program return TRUE?
I'm assuming that it has something to do with the integer value. :cursing:


Sign In
Create Account


Back to top









