【发布时间】:2013-10-12 15:23:15
【问题描述】:
#include<stdio.h>
int main()
{
unsigned short int x=-10;
short int y=-10;
unsigned int z=-10000000;
int m=-10000000;
printf("x=%d y=%d z=%d m=%d",x,y,z,m);
return 0;
}
输出=x=65526 y=-10 z=-10000000 m=-10000000
我的问题是unsigned short int与unsigned int在数据持有情况下有何不同。即x=65526 where as z=-10000000 why x is not equal -10 where as z can hold any data因为短是2字节所以twos complement -10 is 65526但为什么case和z不一样
【问题讨论】:
-
sizeof(unsigned short int)和sizeof(unsigned int)