0
Why does this Code prints "No"
#include <stdio.h> int main() { unsigned int i=23; signed char c=-23; if(i>c) printf("Yes"); else if(i<c) printf("No"); }
2 Antworten
+ 3
jagitsha2 When you compare unsigned and signed types, compiler convert signed variable to unsigned, but because representation of number in memory (see complement two on google) negative numbers (casted to unsigned) would be "valuted" much larger that you think
i repeat, search for complement to two on google and you will understand
0
Can you tell me the reason for using signed char.
What are you expecting by assigning negative value to char variable.