简单小程序 求帮助啊 (关于删除链表的结点)
#include "stdio.h"#include "malloc.h"typedef struct LNode{ int data; struct LNode *next;}LNode,*LinkList;//构造一个链表bool CreatList(LinkList &L){ int x; L=(LinkList)malloc(sizeof(LNode)); scanf("%d",&x); LNode *r=L,*s; while(x!=999) { s=(LinkList)malloc(sizeof(LNode)); s->data=x; r->next=s; r=s; scanf("%d",&x); } r->next=NULL; return true;}//删除链表中最小结点LinkList DeleteMin(LinkList &L){ LNode *p=L,*pre=p->next; LNode *minp=p,*minpre=pre; while (p!=NULL) { if (p->data<minp->data) { minp=p; minpre=pre; } pre=p; p=p->next; } minpre->next=minp->next; free(minp); return L;}void main(){ LinkList L; CreatList(L); DeleteMin(L); while(L->next) { L=L->next; printf("%d",L->data); }}