you know, people often say things like "C is a deeply unserious programming language for modern times — it doesn't even have a hash table in the standard library!". and these people are wrong.
in one of my favorite bits of lore, C does in fact have a hash table in the standard library!
... well, if you count POSIX as the standard C library, at least. everyone implements POSIX, right?
also note that I said "a hash table", not "hash tables". you get one hash table. per process.
and in true C fashion, you have to specify the size when you create it and you cannot resize it later. the glibc manual even notes that you should choose the maximum "wisely".
for a fun time, `man hcreate`.
in one of my favorite bits of lore, C does in fact have a hash table in the standard library!
... well, if you count POSIX as the standard C library, at least. everyone implements POSIX, right?
also note that I said "a hash table", not "hash tables". you get one hash table. per process.
and in true C fashion, you have to specify the size when you create it and you cannot resize it later. the glibc manual even notes that you should choose the maximum "wisely".
for a fun time, `man hcreate`.