Ai
1 Star 13 Fork 17

觉皇/SoftTimer

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
list.c 731 Bytes
一键复制 编辑 原始数据 按行查看 历史
觉皇 提交于 2023-03-24 17:17 +08:00 . 添加单链表文件
/*
* list.c
*
* Created on: 2023年3月24日
* Author: hello
*/
#include "list.h"
void list_add_head(list_t** l, list_t* entry)
{
list_t* p = *l;
while(p != NULL)
{
if(p == entry) return;
p = p->next;
}
entry->next = *l; /* 将表头所指向的条目挂到当前条目后 */
*l = entry; /* 将表头指向当前条目 */
}
void list_add_tail(list_t** l, list_t* entry)
{
while(*l != NULL)
{
if(*l == entry) return;
l = &((*l)->next);
}
*l = entry;
}
void list_del(list_t** l, list_t* entry)
{
while(*l != NULL)
{
if(*l == entry)
{
*l = entry->next;
entry->next = NULL;
return;
}
l = &((*l)->next);
}
}
void list_init(list_t** l)
{
*l = NULL;
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C
1
https://gitee.com/jhembed/SoftTimer.git
git@gitee.com:jhembed/SoftTimer.git
jhembed
SoftTimer
SoftTimer
main

搜索帮助