2 Star 0 Fork 0

qcliu / Clib

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
linkedlist.h 2.42 KB
一键复制 编辑 原始数据 按行查看 历史
qcliu 提交于 2015-02-09 10:44 . first commit
/*------------------------------------------------------------------*//*{{{*/
/* Copyright (C) SSE-USTC, 2014-2015 */
/* */
/* FILE NAME : linkedlist.h */
/* PRINCIPAL AUTHOR : qcLiu */
/* LANGUAGE : C */
/* TARGET ENVIRONMENT : ANY */
/* DATE OF FIRST RELEASE : 2015/02/03 */
/*------------------------------------------------------------------*/
/*
* Revision log:
*//*}}}*/
#ifndef LINKEDLIST_H
#define LINKEDLIST_H
#define FALSE 0
#define TRUE 1
#define GETLINK(head) head->next
typedef struct node
{
void* data;
struct node* next;
}LNode;
typedef struct head
{
LNode* next;
int length;
LNode* last;
int Objsize;
}LinkedList;
/* head last
* ---------- ---------
* |head |--> |dummy |-->NULL
* ---------- ---------
* Init the linkedlist. And add a dummy node to make
* the linkedlist op easy.
*
* @qcliu 2015/02/03
*/
LinkedList* initLinkedList();
/*
* Add a node in the last. Succ return 1, else return 0.
*
* @qcliu 2015/02/03
*/
int addLast(LinkedList* head, void* data);
/*
* Return the first node of the list
* @qcliu 2015/02/03
*/
void* getFirst(LinkedList* head);
/*
* Return the last node of the list
* @qcliu 2015/02/03
*/
void* getLast(LinkedList* head);
/*
* Return the node that index refer
* @qcliu 2015/02/03
*/
void* getIndexOf(LinkedList* head, int index);
/*
* Delet the first LNode.
* @qcliu 2015/02/03
*/
int removeFirst(LinkedList* head);
/*
* Delet the node that index refer to.
* note: the last note is significate.
* @qcliu 2015/02/03
*/
int removeIndexOf(LinkedList* head, int index);
/*
* Return length of the linkedlist.
* @qcliu 2015/02/03
*/
int getLength(LinkedList* head);
/*
* Return 0 or 1.
* @qcliu 2015/02/03
*/
int isEmpty(LinkedList* head);
/*
* Find the certain node from the linkedlist.
* note: ptr point to the dummy node. If found the data,
* return the address of the node, else return NULL.
* @qcliu 2015/02/04
*/
void* findLNodeinList(LinkedList* head, void* data);
/*
* Delet the data<T> from the linkedlist. First find the
* data<T> in the list.
* @qcliu 2015/02/04
*/
int removeFromList(LinkedList* head, void* data);
#endif
C
1
https://gitee.com/qcliu/Clib.git
git@gitee.com:qcliu/Clib.git
qcliu
Clib
Clib
master

搜索帮助