代码拉取完成,页面将自动刷新
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "mylink.h"
void mylink_init(mylink *head) //struct node **head = &head
{
*head = NULL;
}
mylink make_node(char *item, int fd)
{
mylink p = (mylink)malloc(sizeof(struct node));
strcpy(p->item,item); //(*p).itme = item;
p->fifo_fd = fd;
p->next = NULL; //#define NULL (void *)0
return p;
}
void mylink_insert(mylink *head, mylink p)
{
p->next = *head;
*head = p;
}
mylink mylink_search(mylink *head, char *keyname)
{
mylink p;
for (p = *head; p != NULL; p = p->next)
if (strcmp(p->item,keyname) == 0)
return p;
return NULL;
}
void mylink_delete(mylink *head, mylink q)
{
mylink p;
if (q == *head) {
*head = q->next;
return;
}
for (p = *head; p != NULL; p = p->next)
if (p->next == q) {
p->next = q->next;
return;
}
}
void free_node(mylink p)
{
free(p);
}
void mylink_destory(mylink *head)
{
mylink p= *head, q;
while (p != NULL) {
q = p->next;
free(p);
p = q;
}
*head = NULL;
}
void mylink_travel(mylink *head, void (*vist)(mylink))
{
mylink p;
for (p = *head; p != NULL; p = p->next)
vist(p);
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。