Bonsoir,
J'ai un projet en langage C, dans lequel il me faut créer un arbre contenant les mots d'un dictionnaire contenu dans un fichier texte. J'arrive bien à extraire les mots du fichier txt, mais j'ai un probléme avec la constitution de l'arbre
Voila la structure des sommets :
/Définition de la structure de donnée de l'arbre
typedef struct Sommet{
char lettre;
char *mot;
char *attrib;
struct Sommet* a;
struct Sommet* b;
struct Sommet* c;
struct Sommet* d;
struct Sommet* e;
struct Sommet* f;
struct Sommet* g;
struct Sommet* h;
struct Sommet* i;
struct Sommet* j;
struct Sommet* k;
struct Sommet* l;
struct Sommet* m;
struct Sommet* n;
struct Sommet* o;
struct Sommet* p;
struct Sommet *q;
struct Sommet *r;
struct Sommet *s;
struct Sommet *t;
struct Sommet *u;
struct Sommet *v;
struct Sommet *w;
struct Sommet *x;
struct Sommet *y;
struct Sommet *z;
struct Sommet *e_a_g; //e_accent_grave
struct Sommet *e_a_a; //e_accent_aigu
struct Sommet *e_a_c; //e_accent_circonflexe
struct Sommet *a_a_g;
struct Sommet *a_a_c;
struct Sommet *i_a_c;
struct Sommet *o_a_c;
struct Sommet *u_a_g;
struct Sommet *u_a_c;
struct Sommet *c_c; //c_cedille
}Sommet,*Arbre;

Et ensuite le programme principale :
int main()
{
//Déclaration des variables utilisées dans le programme
char path[20];
FILE *readinput;
char mot[100];
char bv[100];
char tgn[100];
char dico[200];
long taille,cpt;
char temp;
char tps[4];
//Arbre contenant le dictionnaire
Arbre abr;
Arbre arbre;
abr=(Sommet*)malloc(sizeof(Sommet));
arbre=abr;
//Définition de la table de hachage
str_hash table[3000];
//Programme principal
printf("***************Projet SDD***************\n");
path_dico(path);
puts(path);
readinput=fopen(path,"r"); // Ouverture du fichier texte contenant le dictionnaire
//Ajout des mots dans l'arbre
printf("Chargement du dictionnaire...\n");
while(!feof(readinput))
{
fscanf(readinput,"%s\t%s\t%s\n",mot,bv,tgn);
taille=strlen(mot);//Taille du mot à entrer
abr=arbre;
for(cpt=0;cpt<taille;cpt++)
{
switch(mot[cpt])
{
case 'a':
if(abr->a==NULL) //Si le sous arbre de la lettre n'existe pas on le crée
{
abr->a=(Sommet*)malloc(sizeof(Sommet));
abr=abr->a;
abr->lettre='a'; //On met la lettre corespondante
}
else{
abr=abr->a; //Si il existe, on met la lettre dans le champ 'lettre'
abr->lettre='a';
}
break;
default:
break;
}
}
Il n'ya pas d'erreur à la compilation, mais lors de l'exécution. Windows me renvoie une erreur !
Ici, il n'y a que la lettre a de définis, il reste tout les autres lettres de l'aphabet.
Est ce qu'il aurait une erreur qui saute au yeux que je n'aurais pas vu ?
Merci d'avance !