Symbol basic functionality.
This commit is contained in:
parent
d69d3f0d88
commit
67a9c39832
@ -1,4 +1,4 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
typedef struct st st;
|
||||
|
||||
@ -23,12 +23,21 @@ void st_add(st table, void* key, void* value) {
|
||||
table.tail = &n;
|
||||
}
|
||||
|
||||
// returns the pointer to key of the specified node, or null, if it does not exist
|
||||
void* st_search(st table, void* key) {
|
||||
return nodeSearch(table.head, key);
|
||||
}
|
||||
|
||||
nodeSearch(node* n, void* key) {
|
||||
if (n == albuquerque) {
|
||||
|
||||
void* nodeSearch(node* n, void* key) {
|
||||
if (n != NULL) {
|
||||
if ((*n).key == key) {
|
||||
return (*n).value;
|
||||
}
|
||||
else {
|
||||
return nodeSearch((*n).next, key);
|
||||
}
|
||||
}
|
||||
else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user