list.c

来自「数据结构自己写的循环链表的实现」· C语言 代码 · 共 51 行

C
51
字号
#include <stdio.h>#include <stdlib.h>#include "list.h"void Destroy_List(List **li){	List *temp,*end,*bak=NULL;	temp = *li;	end = *li;	do	{		bak = temp;		free(bak);		temp = temp->next;	}while(temp != end);	*li = NULL;}void Add_Node(List **li,DataType data){	List *new;	new = malloc(sizeof(List));	new->data = data;	if((*li) == NULL)	{		new->next = new;		*li = new;	}	else	{		new->next = (*li)->next;		(*li)->next = new;				}}void Print_List(List *li,PrintData p){	List *temp;	temp = li;	if(!temp)		return;	while(1)	{		p(temp->data);		temp = temp->next;		if (li == temp)			break; 	}}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?