int table::adtRemove(const char * cpKey, const char * cpData) { struct node * current; struct node * previous; 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) { if(current == adtHashTable[adtHashPosition]) { adtHashTable[adtHashPosition] = current->next; } else { previous->next = current->next; } //Free needs to be used because I used malloc free(current->key); free(current->data); delete current; return 1; } previous = current; current = current->next; } } return 0; }