diff --git a/05-methods/README.md b/05-methods/README.md index fc74c08..9a64e5c 100644 --- a/05-methods/README.md +++ b/05-methods/README.md @@ -84,13 +84,14 @@ void ht_delete(ht_hash_table* ht, const char* key) { if (strcmp(item->key, key) == 0) { ht_del_item(item); ht->items[index] = &HT_DELETED_ITEM; + ht->count--; + return; } } index = ht_get_hash(key, ht->size, i); item = ht->items[index]; i++; } - ht->count--; } ``` After deleting, we decrement the hash table's `count` attribute.