回复 11楼 voidx
如果直接 输入0的话,不能按照你程序编写的运行,可以稍微修改一下就可以了
int main()
{
char s[100][100];
int n, i;
printf("How many strings will give me? (1 ~ 100) ");
loop:scanf("%d", &n);
while(n==0){printf("I need a number between 1 and 100 \n");
goto loop;}
printf("please input the strings you want to sort:\n");
while (getchar() != '\n');
for (i = 0; i < n; i++) {
gets(s[i]);
}
sort_chars(&s[0][0], 100, n);
printf("\nAfter sorting, the strings look like these:\n");
for (i = 0; i < n; i++) {
puts(s[i]);
}
return 0;
}