Associative arrays/Creation/C: Difference between revisions

m
no edit summary
(fixed the wiki-markup)
mNo edit summary
Line 7:
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:
 
<syntaxhighlight lang="с">#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
 
Line 50 ⟶ 51:
printf("a => %s\n", hash_lookup(h, "a"));
return 0;
}
}</<syntaxhighlight>
 
==Libraries==
Line 58 ⟶ 60:
{{libheader|Judy}}
 
<syntaxhighlight lang="с">#include <stdio.h>
#include <stdio.h>
#include <Judy.h>
 
Line 91 ⟶ 94:
 
return 0;
}
}</syntaxhighlight>
 
{{libheader|Judy}}
45

edits