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
| int main(void)
{
char **liste_mots = NULL;
int nb_elements = 0;
int i = 0;
liste_mots = charger_fichier("entree.dat", &nb_elements);
if (liste_mots == NULL) {
return (EXIT_FAILURE);
}
liste_mots = trier_tableau(liste_mots, nb_elements);
if (liste_mots == NULL) {
return (EXIT_FAILURE);
}
if (enregistrer_fichier("sortie.dat", liste_mots, nb_elements) != 0) {
return (EXIT_FAILURE);
}
/* Liberation de la memoire allouee */
if (liste_mots) {
for (i=0; i<nb_elements; i++) {
if (liste_mots[i] != NULL) {
free(liste_mots[i]); liste_mots[i] = NULL;
}
}
free(liste_mots); liste_mots = NULL;
}
return EXIT_SUCCESS;
} |