%s和%-s有什么区别啊。
如题
[解决办法]
-是指左对齐,在指定的宽度内,默认右对齐(Left-justify within the given field width; Right justification is the default)
%s和%-s没有指定宽度,二者没区别
[解决办法]
-, which specifies left adjustment of the converted argument in its field.
[解决办法]
#include<stdio.h>#include<stdlib.h>int main(){ int i,j; i=-78; j=65535; printf("%d%d\n",i,j); printf("%4d%4d\n",i,j); printf("%-4d%-4d\n",i,j); printf("%+4d%+4d\n",i,j); printf("%#x%#X\n",i,j); printf("%04d%04d\n",i,j); printf("% d% d\n",i,j); system("pause"); return 0;}