correcteur.c 816 Bytes
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>

#DEFINE MAX_LETTRES 30


typedef struct node {
  struct node * lettres[27];
  bool fin_de_mot;
  int dernier;
} Node;


void ajout_tete(Node **N, char * mot)
{
  Cellule *nouveau = malloc(sizeof(struct node));
  strcpy(nouveau->(*N)->dernier, mot);
  nouveau->suivant = *N;
  *N = nouveau;
}


void ajout_alphab(Node ** pn, char * mot)
{
    if (*pn == NULL) 
    {
        ajout_tete(pn,mot);
    }
    else
    {
      if (strcmp(mot, (*pn)->valeur) != 0)
        {
	  ajout_alphab(pn[((*pn)->dernier)+1],mot);
	  (*pn)->dernier ++;
        }
    }
}


Node * charger_arbre(){
  File * dico;
  char mot[MAX_LETTRES];
  *dico = fopen("words.txt",'r');
  while (fscanf(dico,"%s",mot) == 1){
    ajout_alphab(Arbre,mot);
  }
  fclose();
  return Arbre;
}