int y=1234;printf(“y=%+06d\n”),结果为什么是y=+01234?
来源:学生作业帮 编辑:大师作文网作业帮 分类:综合作业 时间:2024/10/03 21:30:22
int y=1234;printf(“y=%+06d\n”),结果为什么是y=+01234?
+表示 右对齐;
0表示 补零;
6 表示 占6个长度;
为什么还有个+ 号 ?、
+表示 右对齐;
0表示 补零;
6 表示 占6个长度;
为什么还有个+ 号 ?、
加号"+"表示强制显示正负号(+和-).默认是右对齐,想要左对齐就用减号"-".
参考:
- Left-justify within the given field width; Right justification is the default (see width sub-specifier).
+ Forces to precede the result with a plus or minus sign (+ or -) even for positive numbers. By default, only negative numbers are preceded with a - sign.
参考:
- Left-justify within the given field width; Right justification is the default (see width sub-specifier).
+ Forces to precede the result with a plus or minus sign (+ or -) even for positive numbers. By default, only negative numbers are preceded with a - sign.
int y=1234;printf(“y=%+06d\n”),结果为什么是y=+01234?
int y=10;while(y--);printf("%d",y);结果为什么是-1
main() {int y=10; while(y--);printf("y=%d\n",y); }为什么答案是-1啊
main() { int x=10; int y=x++; printf("%d,%d\n",(x++,y),y++);
main() { int x=2002,y=2003; printf("%d\n",(x,y)); } 为什么结果是20
int x=10,y; y=(x++)+(--x); printf("%d,%d",x,y); C语言运行结果 是10,
main() { int x=102,y=012; printf("%2d,%2d\n",x,y); } 执行后输出结果
C语言中一段程序:int y=10;while(y--); printf("y=%d\n”,y); 怎么理解
int x=10,y=20; main() {func();printf("%d,%d\n",x,y);} func()
int x=3,y=2,z=1;printf("%d\n",x/y&~z)
设有如下程序段:int x=2002,y=2003;printf("%d\n",(x,y))
main() { int x=2002,y=2003; printf("%d\n",(x,y)); }