user-0 提问: 大佬可以帮忙看一下这个C语言程序哪里写错了吗？

回复:
user: user-0
content: 引用 3 楼 自信男孩的回复:#include<stdio.h> #include<stdlib.h>  typedef int elemtype;  typedef struct lnode{     elemtype data;     struct lnode *next; }lnode,*linklist;  void insert_sortlist(linklist &L,elemtype e) {     linklist p,s;     s=(linklist)malloc(sizeof(lnode));     if (!s)         exit(0);     s->data=e;     p = L;     while(p->next&&p->next->data <= e)         p = p->next;     s->next = p->next;     //s->next = s;     p->next = s; }  void create_sortlist(linklist &L) {     elemtype e;     L=(linklist)malloc(sizeof(lnode));     L->next=NULL;     printf("建立一个有序链表，输入整形数据以0结束\n");     scanf("%d",&e);     while(e)     {         insert_sortlist(L,e);         scanf("%d", &e);     } }  void mergeincrease(linklist &La,linklist &Lb,linklist &Lc) {     linklist p,q,s,rear;     p=La->next;     q=Lb->next;     Lc=rear=La;     free(Lb);     while(p&&q)     {         if(p->data<q->data)         {s=p;             p=p->next;         }         else         {s=q;             q=q->next;         }         rear->next=s;         rear=rear->next;     }     if(p)         rear->next=p;     else         rear->next=q;  }  void visit_link(linklist phead) {     linklist p = phead->next;      while (p) {         printf("%d ", p->data);         p = p->next;     }     putchar(10); }  /*void traverse(linklist Lc)   {   linklist p;   printf("合并后的链表为:");   for(p=Lc->next;p;p=p->next)   printf("%d",p->data);   printf("\n");   }*/  int main() {     linklist La,Lb,Lc;     create_sortlist(La);     visit_link(La);     create_sortlist(Lb);     visit_link(Lb);     mergeincrease(La,Lb,Lc);     linklist p;     printf("合并后的链表为:");     visit_link(Lc);     /*     for(p=Lc->next;p;p=p->next)         printf("%d",p->data);         */  } 供参考～ 非常感谢╰(*´︶`*)╯！

user: user-0
content: 引用 2 楼 coo135的回复:在insert_sortlist中，s->next=s; 手误了吧，改成p->next=s; 是的，谢谢！

user: user-1
content: #include<stdio.h> #include<stdlib.h>  typedef int elemtype;  typedef struct lnode{     elemtype data;     struct lnode *next; }lnode,*linklist;  void insert_sortlist(linklist &L,elemtype e) {     linklist p,s;     s=(linklist)malloc(sizeof(lnode));     if (!s)         exit(0);     s->data=e;     p = L;     while(p->next&&p->next->data <= e)         p = p->next;     s->next = p->next;     //s->next = s;     p->next = s; }  void create_sortlist(linklist &L) {     elemtype e;     L=(linklist)malloc(sizeof(lnode));     L->next=NULL;     printf("建立一个有序链表，输入整形数据以0结束\n");     scanf("%d",&e);     while(e)     {         insert_sortlist(L,e);         scanf("%d", &e);     } }  void mergeincrease(linklist &La,linklist &Lb,linklist &Lc) {     linklist p,q,s,rear;     p=La->next;     q=Lb->next;     Lc=rear=La;     free(Lb);     while(p&&q)     {         if(p->data<q->data)         {s=p;             p=p->next;         }         else         {s=q;             q=q->next;         }         rear->next=s;         rear=rear->next;     }     if(p)         rear->next=p;     else         rear->next=q;  }  void visit_link(linklist phead) {     linklist p = phead->next;      while (p) {         printf("%d ", p->data);         p = p->next;     }     putchar(10); }  /*void traverse(linklist Lc)   {   linklist p;   printf("合并后的链表为:");   for(p=Lc->next;p;p=p->next)   printf("%d",p->data);   printf("\n");   }*/  int main() {     linklist La,Lb,Lc;     create_sortlist(La);     visit_link(La);     create_sortlist(Lb);     visit_link(Lb);     mergeincrease(La,Lb,Lc);     linklist p;     printf("合并后的链表为:");     visit_link(Lc);     /*     for(p=Lc->next;p;p=p->next)         printf("%d",p->data);         */  } 供参考～

user: user-2
content: 在insert_sortlist中，s->next=s; 手误了吧，改成p->next=s;

user: user-3
content: 知道为什么零回复吗。。。逻辑太复杂。。。