Commit 6ef11f4b03b220a0a5c20ea3c20c8fe7c354c1d0
1 parent
d75f444a
ajout de la desalocation
Showing
3 changed files
with
17 additions
and
3 deletions
Show diff stats
projetfinalaccent
No preview for this file type
projetfinalaccent.c
... | ... | @@ -194,21 +194,29 @@ void correction_mot(struct node tab_arbre_prcp[]) { |
194 | 194 | } |
195 | 195 | } |
196 | 196 | |
197 | -void supp_tete(struct cell** pL) { | |
197 | +/*void supp_tete(struct cell** pL) { | |
198 | 198 | struct cell* p; |
199 | 199 | p = *pL; |
200 | 200 | *pL = (*pL) -> arbreSuivant; |
201 | 201 | free(p); |
202 | +}*/ | |
203 | + | |
204 | +void desalocation(struct node** pL) { | |
205 | + if ((*pL) -> listeFils == NULL) return; | |
206 | + if ((*pL) -> listeFils -> arbreSuivant != NULL) desalocation(&(*pL) -> listeFils -> arbreSuivant -> arbre); | |
207 | + desalocation(&(*pL) -> listeFils -> arbre); | |
208 | + free((*pL) -> listeFils); | |
209 | + free(*pL); | |
202 | 210 | } |
203 | 211 | |
204 | -void desalocation(struct | |
205 | - | |
206 | 212 | int main(int argc, char* argv[]) { |
207 | 213 | |
214 | + int i =0; | |
208 | 215 | setlocale(LC_ALL, ""); |
209 | 216 | FILE* dico = NULL; |
210 | 217 | FILE* txt = NULL; |
211 | 218 | struct node tab_arbre[A]; |
219 | + struct node * a; | |
212 | 220 | |
213 | 221 | if(argc>2) { |
214 | 222 | dico = fopen(argv[1], "r"); |
... | ... | @@ -226,6 +234,12 @@ int main(int argc, char* argv[]) { |
226 | 234 | remplir_dico(dico, tab_arbre); //on suppose qu'il n'y a pas d'accents dans le dictionnaire |
227 | 235 | correction_txt(txt, tab_arbre); |
228 | 236 | correction_mot(tab_arbre); |
237 | + for(wchar_t u = 'a'; u < A; u++) { | |
238 | + a=&tab_arbre[i]; | |
239 | + desalocation(&a); | |
240 | + i++; | |
241 | + } | |
242 | + | |
229 | 243 | |
230 | 244 | return 0; |
231 | 245 | } | ... | ... |
No preview for this file type