弱弱的问下!!!
#include <stdio.h>#include<string.h>
int main(void)
{
char name[40];
scanf("%s",&name);
printf("%s\n",name);
printf("%d",strlen(name));
return 0;
}
这个显示字符的个数怎么在末尾对齐,加了一个-号也不行哦
char name[] = "TonyDeng"; char strFormat[80]; int len = 5; sprintf(strFormat, "\%%%dd", len); printf(strFormat, strlen(name));