munificent / craftinginterpreters

Repository for the book "Crafting Interpreters"
http://www.craftinginterpreters.com/
Other
8.87k stars 1.04k forks source link

Chapter 20 (Hash tables) challenge 1 solution bug #1091

Open bayerf42 opened 2 years ago

bayerf42 commented 2 years ago

The bold code fragment should be IS_EMPTY. Otherwise the key nil would not be possible in a hash table.

+bool tableGet(Table table, Value key, Value value) { if (table->entries == NULL) return false;

Entry* entry = findEntry(table->entries, table->capacity, key);