-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtable.c
More file actions
37 lines (29 loc) · 654 Bytes
/
table.c
File metadata and controls
37 lines (29 loc) · 654 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
* table.c -- the symbol table
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "common.h"
#include "utils.h"
#include "table.h"
Tabelle *newtable;
Tabelle *aendereTabelle(Tabelle *tabelle, char *name, int wert) {
newtable = allocate(sizeof(tabelle));
newtable->name = name;
newtable->wert = wert;
newtable->next = tabelle;
return (newtable);
}
int sucheWert(Tabelle *tabelle, char *name) {
while(tabelle) {
if(strcmp(tabelle->name, name) == 0) {
return(tabelle->wert);
} else if(strcmp(newtable->name, name) == 0) {
return(newtable->wert);
}
else {
return(sucheWert(tabelle->next, name));
}
}
}