Salut, alors voila, je code sous DevC++ 4.9.9.0
C'est mon premier programme utilisant les Listes chainees, et je n 'arrive pas a comprendre pourquoi il veut pas compiler
le programme suivant :
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include <malloc.h>
main()
{
int x;
typedef struct ListeC
{
int nb;
struct ListC *suivant;
};
struct ListeC depart, *noeud;
depart.suivant=NULL;
noeud=&depart;
printf("entrez un nombre\n");
do
{
scanf("%d",&x);
noeud->suivant=(struct ListeC *)malloc(sizeof(struct ListeC)); // ligne 26
noeud=noeud->suivant; // ligne 27
noeud->nb=x;
noeud->suivant=NULL;
printf("\appuyer sur e pour entrer un autre nombre sinon vous allez sortir\n");
}while (getch()=='e');
system("PAUSE");
}
Il affiche les erreurs suivantes :
-ligne 26 :cannot convert `main()::ListeC*' to ` main()::ListC*' in assignment
-ligne 27 :cannot convert `main()::ListC*' to ` main()::ListeC*' in assignment
Voila merci d'avance pour votre aide
Le bonheur ne serait-il pas un mot inventé un jour d'ennui ?