An educational hash map implemented in C with string keys and generic pointer values (void*).
Uses separate chaining for collisions and supports load factor + resizing (rehashing).
This repository contains only code and documentation written by me (no course handouts/prompts or instructor-provided tests).
put(key, value)— insert/replace (returns previous value orNULL)get(key)— lookup (returns value orNULL)remove(key)— delete (returns removed value orNULL)getloadfactor()— returnssize / bucketsresize(targetLF)— resizes bucket array to approach a target load factor and rehashes entries
src/strmap.c— implementationsrc/strmap.h— public APIdemo.c— small demo harnesstests/— test suite (basic, edge keys, resize invariants, fuzz-ish)
From the repo root:
gcc -Wall -Wextra -std=c11 -Isrc -o demo.exe demo.c src\strmap.c
.\demo.exe