#include<stdio.h> #include<stdlib.h> struct node { int data; struct node *next; }; int n,f,m; struct node *creat(void) { struct node *head,*p1,*p2; int i=0; head=NULL; for(i=0;i<n;i++) { scanf("%d",&m); p1=(struct node*)malloc(sizeof(struct node)); p1->data=m; p1->next=NULL; if(head==NULL) { head=p1; } else p2->next=p1; p2=p1; } return head; } struct node *del(struct node *head,int f) { struct node *p1,*p2; p1=head; while(p1!=NULL) { if(f==p1->data) { if(p1==head) { head=p1->next; p2=p1->next; }
计算概论(A) / 结构体与链表练习
最新推荐文章于 2023-06-27 11:32:30 发布