程序能运行但是一到这个排序,程序就卡住不动了

void index(struct customer **head)
{
struct customer *arrowhead;
struct customer *compare;
struct customer *temp1,*temp2;
arrowhead=*head;
for(;arrowhead!=NULL;)
{compare=arrowhead->next;
for(;compare!=NULL;)
{

    if(strcmp(arrowhead->index >,compare->index)>0)
    {
        temp1=arrowhead;
        arrowhead=compare;
        compare=temp1;
        temp2=arrowhead->next;
        arrowhead->next=compare->next;
        compare->next=temp2;
    }
    compare=compare->next;
   }
   arrowhead=arrowhead->next;
}

}

arrowhead->next;需要判断arrowhead是否存在
if(arrowhead->next!=NULL)
compare=compare->next;
这个也是如此