All pastes #508482 Raw Edit

Untitled

public cpp v1 · immutable
·published 2007-05-25 01:13 UTC
rendered paste body
int table::adtRemove(const char * cpKey, const char * cpData){    struct node * current;    unsigned int adtHashPosition = 0;    int i = 0;        for(int i = 0; i < strlen(cpKey); i++)    {        adtHashPosition = adtHashPosition + cpKey[i];    }    adtHashPosition = adtHashPosition % hashsize;    current = adtHashTable[adtHashPosition];        if(!current)        return 0;        i = 0;    while(current)    {        if(strcmp(current->key, cpKey) == 0)        {            if(strcmp(current->data, cpData) == 0)            {                temp = current->next;                //Free needs to be used because I used malloc                free(current->key);                free(current->data);                delete current;                current = temp;                return 1;            }                        current = current->next;        }    }        return 0;}