我尝试执行以下程序:
#include <stdio.h>
int main() {
signed char a = -5;
unsigned char b = -5;
int c = -5;
unsigned int d = -5;
if (a == b)
printf("\r\n char is SAME!!!");
else
printf("\r\n char is DIFF!!!");
if (c == d)
printf("\r\n int is SAME!!!");
else
printf("\r\n int is DIFF!!!");
return 0;
}
对于这个程序,我得到了输出:
Char 是 DIFF! ! ! Int 是一样的! ! !
为什么我们得到的结果都不一样?
输出应该如下吗?
Char 也一样! ! ! Int 是一样的! ! !