ADDTH(3)

NAME
addTH - adds a new item in a hash table.

SYNOPSYS
#include "logmmm.h"
void addTH(pTable,key,value)
pTH pTable;
char *key;
int value;

PARAMETERS

pTable
    Hash table.

key Key used by the hash coding function.

value
    Associated value (pointer must be casted)

DESCRIPTION
addTH() adds a new item in pTable. If the key already exists, the old value is replaced by the new value. Value must be distinct from -1 (EMPTYTH) and -2 (DELETETH). The length of the table increases automatically when the length given in createTH() is insufficient.

EXAMPLE
#include "mutnnn.h"
#include "logmmm.h"
pTH mytable;
mytable = createTH(100);
addTH(mytable,namealloc("var1"),0);
addTH(mytable,namealloc("var2"),1);

ERROR
"addTH : error - value is EMPTYTH or DELETETH"
The value must be distinct from -1 and -2.

SEE ALSO
log(1), tsh(1), createTH(3), destroyTH(3), searchTH(3), deleteTH(3), displayTH(3).