C语言 双向链表创建,添加,删除

要求最简单的,多写点注释,拜托大家了
2025-02-21 22:21:03
推荐回答(1个)
回答1:

/*用gcc编译的可以*/
#include
#include

typedef struct dlist
{
int score;
struct dlist *pre;
struct dlist *next;
}DLIST;

void creat(DLIST *h,int num) //创建链表,h为表头,num为你要创建的节点数
{
int i;
DLIST *q;
q=h;
h->pre=NULL;

for(i=0;i {
DLIST *p=(DLIST *)malloc(sizeof(DLIST));
printf(