-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.c
More file actions
34 lines (27 loc) · 695 Bytes
/
main.c
File metadata and controls
34 lines (27 loc) · 695 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
#include <stdio.h>
#include <stdlib.h>
#include "trie.h"
int main()
{
Node *root = getNode();
char words[][15] = {"jan", "jane", "janfranco", "janefranco", "janfrancocom"};
for (int i=0; i<5; i++)
insert(root, words[i]);
/*char printWord[15];
printTrie(root, printWord, 0);
printf("--------\n");*/
int idx = 0;
char c;
char *word = malloc(sizeof(char) * 1);
while ((int) c != 13) {
c = getch();
word[idx] = c;
idx++;
word[idx] = '\0';
printf("%s\n", word);
word = realloc(word, sizeof(char) * (idx + 1));
printf("-------\n");
getSuggestions(root, word);
}
return 0;
}