调用函数对字符按大小排序 错在哪了
#include<stdio.h>#include<string.h>
int main()
{
int i;
void pai(char);//定义排序函数
char s[10] = { 'a','d','c','h','g' };
printf("排序前");
for (i = 0;i < strlen(s);i++)
printf("%d", s[i]);
pai(s[10]);
printf("排序后");
for (i = 0;i < strlen(s);i++)
printf("%d", s[i]);
return 0;
}
void pai(char s[10])
{
int i, j, k;
char t;
for (i = 0;i < strlen(s);i++)
{
k = i;
for (j = 0;j < strlen(s);j++)
if (s[j]>s[i]) k = j;
{
t = s[i];s[i] = s[j];s[j] = s[t];
}
}
}