下列给定程序中,函数fun()的功能是:读入一个字符串(长度<20),将该字符串中的所有字符按ASCII码降序排序

#include <conio.h>
#include <stdio.h>
/**********************found***********************/
void fun(char t[]);
{
char c;
int i,j;
for(i=0;i<strlen(t)-1;i++)
for(j=i+1;j<strlen(t);j++)
if(t[i]<t[j])
{
c= t[j];
/**********************found***********************/
t[j]=t[i++];
t[i]=c;
}
}

main()
{
char s[81];
printf("\nPlease enter a character string :");
gets(s);
printf("\n\nBefore sorting :\n %s",s);
fun(s);
printf("\nAfter sorting decendingly:\n %s",s);
}

做为实现交换的中间量,临时保存t[j]
温馨提示:答案为网友推荐,仅供参考