Jump to content

Associative arrays/Creation/C: Difference between revisions

→‎From Scratch: more values
(Add simple simple way to create hash tables in C)
(→‎From Scratch: more values)
Line 5:
 
==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 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 {
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.