arbre.c
813 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
typedef struct arbre{
char val;
char *suite[26];
bool finmot; //1 si fin de mot
}Arbre;
typedef struct dico {
Arbre *alpha[26];
}Dico;
void arbre_vide(struct arbre ** pt_arbre)
{
*pt_arbre = NULL;
}
bool est_vide(struct arbre *arbre)
{
return arbre==NULL;
}
bool fin_de_mot(struct arbre *arbre)
{
return arbre->finmot;
}
void cons_dico(struct dico **pt_dico,char val){
struct dico *mondico=malloc(sizeof(struct dico));
mondico->alpha[val-97]=val; // (ascii)->a = 97
(*pt_dico)=mondico;
}
void cons_arbre(struct arbre **pt_arbre,char val){
struct arbre *monarbre=malloc(sizeof(struct arbre));
mondico->alpha[val-97]=val; // (ascii)->a = 97
}
int main (){
return 0;
}