Skip to content

mtmatt/c-template-library

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

C Template Library

Installation

git clone https://github.com/mtmatt/c-data-structures.git # or download the zip
cd c-data-structures
make

Usage

Include the header file

#include <cds/array.h>
#include <cds/stack.h>
#include <cds/queue.h>
#include <cds/util.h>
// ...

Compile

gcc -o main main.c -I/path/to/c-data-structures/include -L/path/to/c-data-structures/lib -lcds

Data Structures

Functions in common

  1. cds_<data structure name>_new: create a new data structure
  2. cds_<data structure name>_delete: free the memory used by a data structure
  3. cds_<data structure name>_size: get the number of elements in a data structure
  4. cds_<data structure name>_empty: check if a data structure is empty

Structs

  1. Array
  2. Stack
  3. Queue
  4. List (Doubly Link List)
  5. String
  6. AVL Tree
  7. Red-Black Tree

Utilities

  1. ERR_EXIT(s): print an error message and exit
  2. CONV(type): convert a pointer to a type and dereference it
CONV(int32_t) cds_stack_top(&stack);
// is equivalent to
*(int32_t*) cds_stack_top(&stack);

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors