Commit 5e43fa773317f401705a2e780dd6bfde80df59fa
1 parent
d4da0378
arbre.c
Showing
1 changed file
with
55 additions
and
0 deletions
Show diff stats
... | ... | @@ -0,0 +1,55 @@ |
1 | +#include <stdio.h> | |
2 | +#include <stdlib.h> | |
3 | +#include <stdbool.h> | |
4 | + | |
5 | + | |
6 | +typedef struct arbre{ | |
7 | + char val; | |
8 | + char *suite[26]; | |
9 | + bool finmot; //1 si fin de mot | |
10 | +}Arbre; | |
11 | + | |
12 | +typedef struct dico { | |
13 | + Arbre *alpha[26]; | |
14 | +}Dico; | |
15 | + | |
16 | + | |
17 | + | |
18 | + | |
19 | + | |
20 | + | |
21 | +void arbre_vide(struct arbre ** pt_arbre) | |
22 | +{ | |
23 | + *pt_arbre = NULL; | |
24 | +} | |
25 | + | |
26 | +bool est_vide(struct arbre *arbre) | |
27 | +{ | |
28 | + return arbre==NULL; | |
29 | +} | |
30 | + | |
31 | +bool fin_de_mot(struct arbre *arbre) | |
32 | +{ | |
33 | + return arbre->finmot; | |
34 | +} | |
35 | + | |
36 | +void cons_dico(struct dico **pt_dico,char val){ | |
37 | + struct dico *mondico=malloc(sizeof(struct dico)); | |
38 | + mondico->alpha[val-97]=val; // (ascii)->a = 97 | |
39 | + (*pt_dico)=mondico; | |
40 | +} | |
41 | + | |
42 | +void cons_arbre(struct arbre **pt_arbre,char val){ | |
43 | + struct arbre *monarbre=malloc(sizeof(struct arbre)); | |
44 | + mondico->alpha[val-97]=val; // (ascii)->a = 97 | |
45 | + | |
46 | +} | |
47 | + | |
48 | +int main (){ | |
49 | + | |
50 | + | |
51 | + | |
52 | + | |
53 | + | |
54 | + return 0; | |
55 | +} | ... | ... |