这个对连表进行排序的函数不知道错在那里 请各位指教一下 谢谢
struct student{
char num[4];
char name[100];
float score;
struct student*next;
};
void paixu(struct student*p,int n) //n是连表的接点数//
{
struct student temp,*head;
int i,j;
head=p;
for(i=0;i<n-1;i++)
{for(j=0;j<n-i;j++)
{if(strcmp(p->num,(p->next)->num)>0)
{strcpy(temp.num,p->num);
strcpy(p->num,(p->next)->num);
strcpy((p->next)->num,temp.num);
strcpy(temp.name,p->name);
strcpy(p->name,(p->next)->name);
strcpy((p->next)->name,temp.name);
temp.score=p->score;
p->score=(p->next)->score;
(p->next)->score=temp.score;}
p=p->next;
}
p=head;} //在下一伦开始时使p回到head//
}