hsearch.3
来自「<B>Digital的Unix操作系统VAX 4.2源码</B>」· 3 代码 · 共 89 行
3
89 行
.\" SCCSID: @(#)hsearch.3 8.1 9/11/90.TH hsearch 3 .SH Namehsearch, hcreate, hdestroy \- manage hash search tables .SH Syntax.B #include <search.h>.PP.B \s-1ENTRY\s+1 \(**hsearch (item, action).br.B \s-1ENTRY\s+1 item;.br.B \s-1ACTION\s+1 action;.PP.B int hcreate (nel).br.B unsigned nel;.PP.B void hdestroy ( ).SH Description.NXR "hsearch subroutine".NXR "hcreate subroutine".NXR "hdestroy subroutine".NXR "hash table search routine"The.PN hsearchsubroutineis a hash-table search routine generalized from Knuth (6.4) Algorithm D.It returns a pointer into a hash table indicating the location at whichan entry can be found.The.I item\^is a structure of type ENTRY(defined in the <search.h> header file)containing two pointers:.I item.key\^points to the comparison key, and.I item.data\^points to any other data to be associated with that key.(Pointers to types other than charactershould be cast to pointer-to-character.)The.I action\^is a member of an enumeration type ACTIONindicating the disposition of the entryif it cannot be found in the table.ENTER indicates that the item should be inserted in the table at anappropriate point.FIND indicates that no entry should be made.Unsuccessful resolution is indicated by the return of a NULL pointer..PPThe.PN hcreatesubroutineallocates sufficient space for the table, and must be called before.PN hsearchis used.The.I nel\^is an estimate of the maximum number of entries thatthe table will contain.This number may be adjusted upward by thealgorithm in order to obtain certain mathematically favorablecircumstances..PPThe.PN hdestroysubroutine destroys the search table,and may be followed by another call to.PN hcreate ..SH Restrictions.NXR "hsearch subroutine" "restrictions"Only one hash search table may be active at any given time..SH DiagnosticsThe.PN hsearchsubroutine returns a NULLpointer if either the action is FINDand the item could not be found or the action is ENTERand the table is full..PPThe.PN hcreatesubroutinereturns zero if it cannot allocate sufficient space for thetable..SH See Alsobsearch(3), lsearch(3), string(3), tsearch(3)
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?