表达式语法错在sort函数

来源:百度知道 编辑:UC知道 时间:2024/06/08 17:03:14
void sort(link h)
{
link u,v,s,t;
s=h->next->next;
h->next->next=NULL;
while(s!=NULL)
{
t=s;
s=s->next;
u=h;
v=u->next;
while(v->next&&v->v.total<=t->v.total)
{
u=v;
v=v->next;
}
u->next=t;
t->next=v;
}

少个右括号,楼主怎么这么粗心呢?

#define NULL 0
typedef struct _link{
int total;
struct _link * next;
} *link;//加定义

void sort(link h)
{
link u,v,s,t;
s=h->next->next;
h->next->next=NULL;
while(s!=NULL)
{
t=s;
s=s->next;
u=h;
v=u->next;
while(v->next&&(v->total<=t->total)) // 改
{
u=v;
v=v->next;
}
u->next=t;
t->next=v;
}
}//加

楼主要保证用到的东西 有定义