Bonjour, tout d'abord, voici mon code:
En compilant, j'obtient:
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
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39 typedef struct //Struct Token { int color; int shape; } Token; enum {ROUGE, VERT, BLEU, JAUNE, NB_SHAPE}; enum {CERCLE, CARRE, TRIANGLE, DIAMANT, NB_COLOR}; typedef struct PlayedToken //Struct PlayedToken { Token *jeton; struct playedToken* next; struct playedToken* nextColor; struct playedToken* prevColor; struct playedToken* nextForm; struct playedToken* prevForm; } PlayedToken; typedef struct //Struct TokenList { int length; PlayedToken* head; PlayedToken* tail; PlayedToken* head_color[NB_COLOR]; PlayedToken* head_shape[NB_SHAPE]; } TokenList; int addPlayedTokenHead(TokenList *tokenlist, Token *token) { PlayedToken *tmp; if ((PlayedToken *)malloc(sizeof(PlayedToken)) == NULL) return -1; tmp->jeton = token; tmp->next = tokenlist->head; tokenlist->head = tmp; tokenlist->length++; return 0; }
main.c:35:15: error: assignment from incompatible pointer type [-Werror]
tmp->next = tokenlist->head;
Pourtant, les 2 pointeurs sont de type PlayedToken*.
Merci d'avance !
Partager