Associative arrays/Creation/C: Difference between revisions
Content added Content deleted
(Add simple simple way to create hash tables in C) |
(→From Scratch: more values) |
||
Line 5: | Line 5: | ||
==From Scratch== |
==From Scratch== |
||
A hash table can be implemented with the following. Because of this example's simplicity, it comes with some restrictions on use and capabilities: It can't be resized automatically, if you try to insert values than its capacity it will freeze, the hashing function is very simple, etc. All are fixable with additional logic or using a library: |
A hash table can be implemented with the following. Because of this example's simplicity, it comes with some restrictions on use and capabilities: It can't be resized automatically, if you try to insert more values than its capacity it will freeze, the hashing function is very simple, etc. All are fixable with additional logic or using a library: |
||
<lang c>typedef struct { |
<lang c>typedef struct { |