Skip to content

tsoding/ht.h

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

Hash Table in C

It's just a Hash Table in C but with a nice Generic API.

Quick Start

#include <stdio.h>
#define HT_IMPLEMENTATION
#include "ht.h"

int main(void)
{
    Ht(const char *, int) ht = {
        .hasheq = ht_cstr_hasheq,
    };
    *ht_put(&ht, "foo") = 69;
    *ht_put(&ht, "bar") = 420;
    *ht_put(&ht, "baz") = 1337;
    ht_foreach(value, &ht) {
        printf("%s => %d\n", ht_key(&ht, value), *value);
    }
    ht_free(&ht);
    return 0;
}

About

Hash Table in C but with a nice Generic API

Resources

Stars

Watchers

Forks

Packages

 
 
 

Languages