/* Looks up a key and returns the corresponding value, or NULL */ Value *list_lookup(Node *list, Hashable *key) { while (list != NULL) { if (equal_hashable(list->key, key)) { return list->value; } list = list->next; } return NULL; }
/* Looks up a key and returns the corresponding value, or NULL */ Value *list_lookup(Node *list, Hashable *key) { Node *node; for (node = list; node != NULL; node = node->next) { if (equal_hashable(key, node->key)) { return node->value; } } return NULL; }
/* Looks up a key and returns the corresponding value, or NULL */ Value *list_lookup(Node *list, Hashable *key) { Node* current = list; // Initialized to the start of the list while (current) { if (equal_hashable(current->key,key)) { return current->value; } current = current->next; } return NULL; }
/* Looks up a key and returns the corresponding value, or NULL */ Value *list_lookup(Node *list, Hashable *key) { Node *node; node = list; while (node != NULL) { if (equal_hashable(node->key, key)) return node->value; node = node->next; } return NULL; }