DICTCREATE

Top  Previous  Next

Syntax

POINTER = DICTCREATE(OPT hashtablesize=17 as INT,OPT blocksize=10 as INT)

Description

Creates an associative array (dictionary) and initialize the hash table.

Parameters

hashtablesize - Number of entries in the hash table. For best performance, the hash table size should be a prime number. To minimize collisions the size should be roughly 20 percent larger than the largest anticipated data set.  (optional default=17)

blocksize - Specifies the memory-allocation granularity for extending the hash entries.  (optional default=10)

Return value

A pointer to an associative array..

Remarks

As the array grows, memory is allocated in units of blockSize entries.

Example usage

mydict = DictCreate(100)
 
DictAdd(mydict,"John","Red")
DictAdd(mydict,"Joe","Green")
DictAdd(mydict,"Sue","Yellow")
DictAdd(mydict,"Phil","Purple")
DictAdd(mydict,"Jerry","Orange")
DictAdd(mydict,"Lisa","Blue")
DictAdd(mydict,"Tammy","Black")
DictAdd(mydict,"George","white")
DictAdd(mydict,"Paul","Indigo")
DictAdd(mydict,"Merideth Abigal","Violet")")