#define new (struct lb*)malloc (sizeof(struct lb))
struct lb
{int data;
struct lb *next;
};
struct lb *hb(struct lb *wla,struct lb *wlb)
{struct lb *wlc,*p,*q,*w;
p=wla;q=wlb;w=wlc=new;
while(p!=0&&q!=0)
{
if (p->data
{w->next=new;w=w->next;
w->data=p->data;
p=p->next;
}
else if(p->data>q->data)
{w->next=new;w=w->next;
w->data=q->data;
q=q->next;
}
}
while(p!=0)
{w->next=new;w=w->next;
w->data=p->data;
p=p->next;
}
while(q!=0)
{w->next=new;w=w->next;
w->data=q->data;
q=q->next;
}
w->next=0;
wlc=wlc->next;
return(wlc);
}
prn(struct lb *whead)
{ struct lb *p;
p=whead;
while(p!=0)
{printf("%d",p->data);
p=p->next;
}
}
main()
{struct lb *la,*lb,*lc;
la=crea_lb();
lb=crea_lb();
lc=hb(la,lb);
prn(lc);
}
以上就是你要的代码.prn函数是显示出新的链表.