From d6bcca7adb0f24fcaa02975d075aca1787b7f857 Mon Sep 17 00:00:00 2001 From: rsSimonin Date: Thu, 28 Mar 2019 11:00:59 +0100 Subject: [PATCH] initialisation --- arbre.c | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/arbre.c b/arbre.c index 2c4db25..760302c 100644 --- a/arbre.c +++ b/arbre.c @@ -5,7 +5,7 @@ typedef struct arbre{ char val; - char *suite[26]; + struct arbre *suite[26]; bool finmot; //1 si fin de mot }Arbre; @@ -17,7 +17,6 @@ typedef struct dico { - void arbre_vide(struct arbre ** pt_arbre) { *pt_arbre = NULL; @@ -32,19 +31,41 @@ bool fin_de_mot(struct arbre *arbre) { return arbre->finmot; } +void initialise_dico(struct arbre * pt_arbre,char val){ + + + +} void cons_dico(struct dico **pt_dico,char val){ - struct dico *mondico=malloc(sizeof(struct dico)); - mondico->alpha[val-97]=val; // (ascii)->a = 97 + Dico *mondico=malloc(sizeof(struct dico)); + mondico->alpha[val-97]->val=val; // (ascii)->a = 97 + for(int i=0;i<26;i++){ + mondico->alpha[val-97]->suite[i]=NULL; + } + mondico->alpha[val-97]->finmot=false; (*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 + monarbre->suite[val-97]->val=val; // (ascii)->a = 97 } + + +void ini_dico(struct dico * pt_dico){ + for(int i=0;i<26;i++){ + cons_dico(&pt_dico,97+i); + } +} + + + + + + int main (){ -- libgit2 0.21.2