Skip to content

silicondosa/cLinkedList

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cLinkedList - A simple linked list manager for C/C++

This is a simple linked list manager for C that I've been using for a long while now. It may not be as optimized as Boost's libraries for linked lists, but it is very simple to use and has been tested rigorously.

This library allows you to dynamically create and manage doubly linked lists of elements that already exist in memory using pointers. This means that the actual data is untouched by this library which essentially manages a linked list of pointers to data.

Supported platforms and binaries

In addition to the source, you can download cLinkedList as a precompiled library. It is currently only available as a static library for 64-bit Windows, but I will make a DLL available when I have a time away from academics.

At some point, I will also build shared and static libraries for 64-bit PC Linux.

Usage

Download the repo and place it in your project directory. Be sure to add the include directory along with either the bin/msvc/Win32/ or bin/msvc/x64/ directory to your compile and linker paths respectively. You do not need the source and cLinkedList directories, both of which can be safely removed.

Supported functionalities and documentation

Doxygen documentation for each of the functionalities below are linked with the functions. The Doxygen documentation home page is here.

1. Linked list creation/modification functions

  • Initialize a linked list in dynamic memory (cListInit).
  • Insert a data item AFTER an existing linked list element (cListInsertAfter).
  • Insert a data item BEFORE an existing linked list element (cListInsertBefore).
  • Append a data item to the end of a linked list (cListAppend).
  • Prepend a data item to the start of the linked list (cListPrepend).

2. Linked list reading functions

3. Linked list status functions

4. Linked list unlinking functions

  • Unlink a particular list element in a linked list (cListUnlinkElem).
  • Unlink a list element pointing to specific data item in a linked list (cListUnlinkData).
  • Unlink all list elements from a linked list (cListUnlinkAll).

This library is considered feature-complete for my purposes. If you see any bugs or want a feature implemented, please don't hesitate to open an issue or send pull request my way.

Learning outcomes

POINTERS POINTERS POINTERS! First and foremost, creating this library was an exercise in the correct usage of C pointers. Additionally, this library gave the opportunity to write code that completely platform-agnostic and portable. With only one header and only one source file, it is easy to compile together with your other C/C++ code.

Licensing

This library and its source code is distributed under the Mozilla Public License v2.0.

About

A simple linked list manager for C/C++

Resources

License

Stars

Watchers

Forks