Bonjour, j'ai un problème avec une compilation, je créai une liste chaîné. mais j'ai des warnings à la compilation:
assigment from incompatible pointer type
je vous montre le code:
la fonction qui appelle :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12 typedef struct T_resultat { char resultat[250]; struct T_result *result_suiv; struct T_hyp *hyp_suiv_reg; }T_result; typedef struct T_hypo { char hypotese[250]; struct T_hyp *hyp_suiv_hyp; }T_hyp;
la fonction appelée
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 void ajouter_regle (T_result **pt_tete) { int nb_hyp=0,i=0,j=1; char hyp[200]; T_result* new_result=creer_result(); printf("insérer le nombre d'hypothese"); scanf("%d",&nb_hyp); for (i=0;i<nb_hyp;i++) { T_hyp* new_hyp=creer_hypo(); printf("inserer l'hypothese |%d|:",j); scanf("%s",hyp); ajouter_hypo(new_hyp,&new_result,hyp); j++; } *pt_tete=ajouter_result(new_result,*pt_tete); }
Merci,
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 void ajouter_hypo(T_hyp* S_hypo,T_result **S_resultat,char* C_hypo)/**WRONG*/ { printf("\nOn rentre dans ajouter Hypo"); if(*S_resultat!=NULL && (*S_resultat)->hyp_suiv_reg==NULL) { strcmp(S_hypo->hypotese,C_hypo); (*S_resultat)->hyp_suiv_reg=&S_hypo; //WARNING ICI } else { S_hypo->hyp_suiv_hyp=(*S_resultat)->hyp_suiv_reg; (*S_resultat)->hyp_suiv_reg=S_hypo; //WARNING ICI } printf("\nOn sort de ajouter Hypo"); }
Si vous avez des questions n'hésitez pas
Salutation, Philippe
Partager