C语言高级进阶
链表是由一系列互相连接的节点组成的数据结构,这种数据结构非常有用,是实现队列和栈的基础。
学习内容
这一章我们继续单链表的学习,实现一个无头单链表的创建,插入,按值查找,显示以及销毁。代码来自于(B站)史上最强最细腻的linux嵌入式C语言学习教程【李慧芹老师】,需要学习的童鞋自行搜索观看,此处不多介绍。
学习产出
nohead.h
#ifndef __NOHEAD_H__
#define __NOHEAD_H__
#define NAMESIZE 32
struct score_st
{
int id;
char name[NAMESIZE];
int math;
int chinese;
};
struct node_st
{
struct score_st data;
struct node_st *next;
};
int list_insert(struct node_st **list,struct score_st *data);
void list_show(struct node_st*);
int list_delete(struct node_st **);
struct score_st * list_find(struct node_st *, int id);
void list_distroy(struct node_st *);
#endif