#include <stdio.h>
#include <stdlib.h>
main()
{
short int a,b;
a=-32768;
b=a-3;
printf("%d,%d",a,b);
system("pause");
return 0;
}
结果是-32768,32765
想知道为什么a可以正常输出,b会这样,知道short int是-32767到32767
我想知道具体怎么会出现这样的问题
这样说的话...由于short int只能是16位...
32768是1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-32728的话二进制是1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
却因为是short int而被砍掉了首位?也成了1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
是这样吗?