字符串的排序,哪出错了啊?麻烦各位了~
#include<stdio.h>#include<string.h>
#define MAXSIZE 100
void selectSort(char **str,int n)
{
int i,j,k;
char temp[MAXSIZE];
for(i=1;i<=n;i++)
{
k=i;
for(j=i+1;i<=n;i++)
if(strcmp(str[i],str[j]))
{
strcpy(temp,str[i]);
strcpy(str[i],str[j]);
strcpy(str[j],temp);
}
}
}
void main()
{
char *string[]={"i","hello","world","mini"};
selectSort(string,sizeof(string));
for(int m=0;m<sizeof(string);m++)
printf("%s\n",string[m]);
}