#include main() { char a1,b1; unsigned char a2,b2; int x1,y1; long x2,y2;a1=127; b1=129;a2=127; b2=129;x1=32767;y1=32769;x2=32767;y2=32769;printf(a1=%d,a2=%u,b1=%d,b2=%u\n",a1,a2,b1,b2)printf(x1=%d,x2=%ld,y1=%d,y2=%ld\n",x1,x2,x1,x2)输出结果a1=12
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/26 12:58:57
#include main() { char a1,b1; unsigned char a2,b2; int x1,y1; long x2,y2;a1=127; b1=129;a2=127; b2=129;x1=32767;y1=32769;x2=32767;y2=32769;printf(a1=%d,a2=%u,b1=%d,b2=%u\n",a1,a2,b1,b2)printf(x1=%d,x2=%ld,y1=%d,y2=%ld\n",x1,x2,x1,x2)输出结果a1=12
#include main() { char a1,b1; unsigned char a2,b2; int x1,y1; long x2,y2;
a1=127; b1=129;
a2=127; b2=129;
x1=32767;y1=32769;
x2=32767;y2=32769;
printf(a1=%d,a2=%u,b1=%d,b2=%u\n",a1,a2,b1,b2)
printf(x1=%d,x2=%ld,y1=%d,y2=%ld\n",x1,x2,x1,x2)
输出结果a1=127,a2=127,b1=-127,b2=129
x1=32767,x2=32767,y1=-32767,y2=32769
为什么a1,a2,x1,x2原样输出?b2,y2也是原样输出呢?
#include main() { char a1,b1; unsigned char a2,b2; int x1,y1; long x2,y2;a1=127; b1=129;a2=127; b2=129;x1=32767;y1=32769;x2=32767;y2=32769;printf(a1=%d,a2=%u,b1=%d,b2=%u\n",a1,a2,b1,b2)printf(x1=%d,x2=%ld,y1=%d,y2=%ld\n",x1,x2,x1,x2)输出结果a1=12
printf(a1=%d,a2=%u,b1=%d,b2=%u\n",a1,a2,b1,b2)
printf(x1=%d,x2=%ld,y1=%d,y2=%ld\n",x1,x2,x1,x2)就规定了 %d是以十进制输出,%u是以无符号输出,%ld是以长整形输出,肯定形式就是那样的啊,如果你想以char类型的输出那就将其定义为%c