字母排序求助
#include<stdio.h>
#include<string.h>
void swap(char x[],char y[]);
void main()
{
int i,j;
char ch[7][20]={"george","albert","tina","xavier","roger","tim","william"};
for (i=0;i<6;i++)
{
for (j=0;j<6-i;j++)
{
if(strcmp(ch[j],ch[j+1])>0)
swap(ch[j],ch[j+1]);
}
}
for (i=0;i<7;i++)
printf ("%s\t",ch[i]);
}
void swap(char x[],char y[])
{
char temp[20];
strcpy(temp,x);
strcpy(x,y);
strcpy(y,temp);
}
那位大虾能说明一下..I,J两个变量是杀意思.