求高手指导:关于WIN7下VC 6.0 短整型长度的问题
#include<stdio.h>void main()
{
int s1,s2;
unsigned short int a=65535;
short int b=-2;
printf("a=%hd,%o,%x,%u\n",a,a,a,a);
printf("b=%d,%o,%x,%u\n",b,b,b,b);
s1=sizeof(a);s2=sizeof(b);
printf("%d,%d",s1,s2);
}
输出是:a=-1,177777,ffff,65535
b=-2,37777777776,fffffffe,4294967294
2,2
问题:上面一段程序中b的长度明明是16个字节,为什么printf出来却是32个字节的?