/*
* =====================================================================================
* Filename: singly_link.c
* Author: RollStone (rs), jealdean@outlook.com
* Copyright: All Rights Reserved. Copyright(c) 2007-2014
* Description:
*
* Version: 1.0
* Created: 09/29/2014 21:49
* Revision: none
* Compiler: gcc
* Last_Changed: 2014-10-03 18:29:35
* =====================================================================================
*/
typedef struct node{
struct node *next;
}node;
typedef bool (*remove_fn)(node const *v);
void remove_if(node **header,remove_fn rm)
{
for ( node** curr=head;*curr; )
{
node *entry=*curr;
if(rm(entry))
{
*curr=entry->next;
free(entry);
}
else
{
curr=&entry->next;
}
}
}
不同寻常的单链表删除的方法
最新推荐文章于 2022-09-02 22:30:48 发布