1 Star 0 Fork 0

linxueya/Robot

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
link.c 1.11 KB
一键复制 编辑 原始数据 按行查看 历史
linxueya 提交于 2020-06-13 12:00 . new file: client.c
#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);
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C
1
https://gitee.com/linxueya/Robot.git
git@gitee.com:linxueya/Robot.git
linxueya
Robot
Robot
master

搜索帮助