![]() |
![]() |
![]() |
Create a hash search table
#include <search.h> int hcreate( size_t nel );
libc
The hcreate() function allocates space for the hash search table, and must be called before hsearch() is used. The nel argument is an estimate of the maximum number of entries that the table will contain. This number may be adjusted upward by the algorithm in order to obtain certain mathematically favorable circumstances.
The hsearch() and hcreate() functions use malloc() to allocate space.
Only one hash search table may be active at any given time. The table can be destroyed by calling hdestroy().
0 if there isn't enough space available to allocate the table.
See hsearch().
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | No |
Signal handler | No |
Thread | Yes |
bsearch(), hdestroy(), hsearch(), malloc()
The Art of Computer Programming, Volume 3, Sorting and Searching by Donald E. Knuth, published by Addison-Wesley Publishing Company, 1973.
![]() |
![]() |
![]() |