Skip to content

NeevCohen/cmap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CMAP

A minimal hashmap implimintation written in C.

Cmap includes all the basic features of a hashmap -

  • Setting values
  • Getting values
  • Removing values

How to use it

The most basic usage -

#include <cmap.h>

int main() {
    struct cmap_hash_map *hmap = cmap_hash_map_new(16, NULL, NULL);
    cmap_hash_set(hmap, "foo", "foo");
    char *foo = hash_map_get("foo");
    printf("The value is %s\n", foo);

    return 0;
}

This program will produce the following output -

The value is foo

Restrictions

Currently, cmap only supports mapping of char* -> void* , though in the future I do intend to implement a generic version for any type of key.

Tests

The tests in this project are written with the help of the Mintest library

About

A hash map implementation in C

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published