问: [C语言线性表 的顺序形式 最少写创建,查询,插入,删除,输出等功能,完整代码

2025-04-03 06:04:33
推荐回答(1个)
回答1:

#include
typedef struct double_node {
int data;
struct double_node * next;
struct double_node * prev;
} d_node;
void static create(d_node ** head, int d) {
d_node *p = malloc(sizeof(d_node));
p->data = d;
if (*head == NULL) {
*head = p;//because of here needs **
(*head)->next = *head;
(*head)->prev = *head;
} else {
d_node *q = *head;
while (q->next != (*head)) {
q = q->next;
}
q->next = p;
p->next = *head;
p->prev = q;
(*head)->prev = p;