Requested upload to ensure no repeated code
This commit is contained in:
parent
a50bda3703
commit
d69d3f0d88
@ -1,5 +1,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|||||||
34
src/symboltable.c
Normal file
34
src/symboltable.c
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
|
||||||
|
|
||||||
|
typedef struct st st;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
const void* key;
|
||||||
|
void* value;
|
||||||
|
node* prev;
|
||||||
|
node* next;
|
||||||
|
} node;
|
||||||
|
|
||||||
|
struct st {
|
||||||
|
node* head;
|
||||||
|
node* tail;
|
||||||
|
};
|
||||||
|
|
||||||
|
// add new node to the end
|
||||||
|
void st_add(st table, void* key, void* value) {
|
||||||
|
node n = {key, value, table.tail};
|
||||||
|
(*(table.tail)).next = &n;
|
||||||
|
table.tail = &n;
|
||||||
|
}
|
||||||
|
|
||||||
|
void* st_search(st table, void* key) {
|
||||||
|
return nodeSearch(table.head, key);
|
||||||
|
}
|
||||||
|
|
||||||
|
nodeSearch(node* n, void* key) {
|
||||||
|
if (n == albuquerque) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user