-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathidList.h
44 lines (34 loc) · 881 Bytes
/
idList.h
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
38
39
40
41
42
43
44
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
typedef struct idnode {
char *name;
struct idnode *next;
} *idnodeptr;
typedef struct list {
int size;
idnodeptr roots[50];
} list;
list theListOfLists;
print(idnodeptr theList) {
while (theList->next != NULL) {
printf("%s ", theList->name);
theList = theList->next;
}
}
idnodeptr addId(idnodeptr theList, char* id) {
char stringbuf[25];
idnodeptr tempNode = (idnodeptr)malloc(sizeof(struct idnode));
// printf("Enter an id (25 character maximum): ");
// scanf("%s", &stringbuf);
tempNode->name = malloc(strlen(id)+1);
strcpy(tempNode->name, id);
tempNode->next = theList;
return tempNode;
}
idnodeptr insertIdList() {
idnodeptr root = (idnodeptr)malloc(sizeof(struct idnode));
theListOfLists.roots[theListOfLists.size] = root;
theListOfLists.size++;
return root;
}