Search code examples
chashtable

Does C have hash/dictionary data structure?


I'm learning C now coming from knowing perl and a bit python. I did a quick search and found there is no explicit hash/dictionary as in perl/python and I saw people were saying you need a function to look up a hash table. So the fact is C doesn't provide an inherent hash structure and you have to write some function to be able to use hash in C?


Solution

  • Basically, the only data structure that C has are arrays, structs (which is kind of like a map, but the keys must be known at compile time) and unions. Everything else must be coded manually or provided by a library.