死循环了,不懂为什么,求哥哥姐姐们指教!我是新手,莫怪---
struct student *sort(struct student *head)
{
if(!head)
{
goto END;
}
struct student *min,*p,*end;
struct student temp;
for(min = head;min != NULL;min = min->next)
{
end = min;
}
for(min = head;min != NULL;min = min->next)
{
for(p = head;p != end;p = p->next)
{
printf("123");
if(min->num > p->num)
{
temp = *min;
*min = *p;
*p = temp;
printf("paixu\n");
}
}
}
END:
return head;
}