diff --git a/Makefile b/Makefile index 804a5fa..5b88990 100755 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ all: executable executable: projet.o - gcc -o executable projet.o + gcc -o executable projet.o -g projet.o: projet.c gcc -c projet.c diff --git a/README.txt b/README.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/README.txt diff --git a/projet.c b/projet.c index 1017d98..688cc3e 100755 --- a/projet.c +++ b/projet.c @@ -59,7 +59,7 @@ void initialiser_dictionnaire(noeud * Arbre[26]){ Arbre[i]=NULL; } -int existe(noeud ** parbre,char ch[128]){ +int existe(noeud ** parbre,char ch[128]){ int n=strlen(ch); int a,cpt=0; noeud ** tmp_parbre=parbre; @@ -92,6 +92,26 @@ void corriger_texte(noeud*arbre[26]){ fclose(texte); } + +void desallouer_arbre(noeud *arbre){ + + if(arbre != NULL) + for(int i=0;i<28;i++){ + if(arbre->lettre[i] != NULL) + desallouer_arbre(arbre->lettre[i]); + } + else + free(arbre); + +} +void desallouer_dictionnaire(noeud*arbre[26]){ + for(int i=0;i<26;i++) + desallouer_arbre(arbre[i]); +} + + + + int main (){ dico d; initialiser_dictionnaire(d.dictionnaire); @@ -101,6 +121,7 @@ int main (){ printf("-----------------------------------------------------------\n"); printf("\nvoici les fautes dans le texte: \n \n"); corriger_texte(d.dictionnaire); + desallouer_dictionnaire(d.dictionnaire); printf("\n"); return 0; -- libgit2 0.21.2