Commit d6bcca7adb0f24fcaa02975d075aca1787b7f857

Authored by rsSimonin
1 parent 5e43fa77

initialisation

Showing 1 changed file with 26 additions and 5 deletions   Show diff stats
... ... @@ -5,7 +5,7 @@
5 5  
6 6 typedef struct arbre{
7 7 char val;
8   - char *suite[26];
  8 + struct arbre *suite[26];
9 9 bool finmot; //1 si fin de mot
10 10 }Arbre;
11 11  
... ... @@ -17,7 +17,6 @@ typedef struct dico {
17 17  
18 18  
19 19  
20   -
21 20 void arbre_vide(struct arbre ** pt_arbre)
22 21 {
23 22 *pt_arbre = NULL;
... ... @@ -32,19 +31,41 @@ bool fin_de_mot(struct arbre *arbre)
32 31 {
33 32 return arbre->finmot;
34 33 }
  34 +void initialise_dico(struct arbre * pt_arbre,char val){
  35 +
  36 +
  37 +
  38 +}
35 39  
36 40 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
  41 + Dico *mondico=malloc(sizeof(struct dico));
  42 + mondico->alpha[val-97]->val=val; // (ascii)->a = 97
  43 + for(int i=0;i<26;i++){
  44 + mondico->alpha[val-97]->suite[i]=NULL;
  45 + }
  46 + mondico->alpha[val-97]->finmot=false;
39 47 (*pt_dico)=mondico;
40 48 }
41 49  
42 50 void cons_arbre(struct arbre **pt_arbre,char val){
43 51 struct arbre *monarbre=malloc(sizeof(struct arbre));
44   - mondico->alpha[val-97]=val; // (ascii)->a = 97
  52 + monarbre->suite[val-97]->val=val; // (ascii)->a = 97
45 53  
46 54 }
47 55  
  56 +
  57 +
  58 +void ini_dico(struct dico * pt_dico){
  59 + for(int i=0;i<26;i++){
  60 + cons_dico(&pt_dico,97+i);
  61 + }
  62 +}
  63 +
  64 +
  65 +
  66 +
  67 +
  68 +
48 69 int main (){
49 70  
50 71  
... ...