#include "stdio.h"#include "conio.h"#include "math.h"struct node{int data;struct node *next;};typedef struct node AA;AA *gz(){AA *h,*r,*b; int a;r=(AA *)malloc(sizeof(AA));h=r;printf("qing shu ru\n");scanf("%d",&a);while(a){ b=(AA *)malloc(sizeof(AA));b->data=a;r->next=b;r=b;scanf("%d",&a);}r->next=NULL;return h;}sh(){AA *to,*pp,*p,*t,*head=gz();p=t=head;//这里 t=t->next;while(t){if(t->data==30){p->next=t->next;//这里一部分 free(t);}p=t;t=t->next;}head=head->next;while(head){ printf("%d",head->data);head=head->next;}}main(){ sh(); getch(); }你对照着看看!! |