no save
Assistance
Achat
News

Forum | programmation
liste chainée et pointeurs en programmation c
nabelou1, le mer. 02 janv. 2008 à 23:57:22
Bonjour,
j'aimerais qu'on m'aide à resoudre un probleme qui me depasse avec les pointeurs et listes chainées
voici le code
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
typedef char chaine[20];
typedef struct voisin *pvoisin;

typedef struct{
chaine nom ;
int dist;
int typ;
pvoisin suiv;}voisin;
typedef struct noeud *pnoeud;

typedef struct{
chaine ville;
int nb;
int ens;
pvoisin vois;
pnoeud suivant;}noeud;

int cpt1,cpt2,n;
chaine orig,dest;
pnoeud tete,courant;
void datasource(chaine fiche)
{
FILE *f;
pnoeud nod1,nod2; pvoisin vnod1,vnod2;
f=fopen(fiche,"r");
fscanf(f,"%d",&n);fscanf(f,"\n");
for(cpt1=0;cpt1<n;cpt1++)
{
nod2=tete;
nod1=(pnoeud)malloc(sizeof(noeud));
fscanf(f,"%s %d\n",nod1->ville,nod1->nb);
for(cpt2=0;cpt2<nod1->nb;cpt2++)
{
vnod2=nod1->vois;
vnod1=(pvoisin)malloc(sizeof(voisin));
fscanf(f,"%s %d %d",vnod1->nom,vnod1->dist,vnod1->typ);
nod1->vois=vnod1;vnod1->suiv=vnod2;
}fscanf(f,"\n\n");
nod1->suivant=nod2;tete=nod1;
}
printf("data load succefully");
}
main()
{
chaine fichier;
printf("entrez le nom du fichier contenant les données");
scanf("%s\n");
datasource(fichier) ;
}

et j'ai une ceci lors de la compilation

C:\Documents and Settings\nabelou\Bureau\tp3\liste.c: In function `datasource':
34: error: dereferencing pointer to incomplete type
34: error: dereferencing pointer to incomplete type
35: error: dereferencing pointer to incomplete type
:37: error: dereferencing pointer to incomplete type
:39: error: dereferencing pointer to incomplete type
39: error: dereferencing pointer to incomplete type
:39: error: dereferencing pointer to incomplete type

40: error: dereferencing pointer to incomplete type
40: error: dereferencing pointer to incomplete type

42: error: dereferencing pointer to incomplete type
43: error: syntax error before '}' token

merci d'avance Configuration: Windows XP
Firefox 2.0.0.11


BloodyAngel
janv. 08
Suivant
REPONSES
BloodyAngel
janv. 08
Doctor C
janv. 08
Doctor C
janv. 08
nabelou1
janv. 08
Doctor C
janv. 08
nabelou1
janv. 08
nabelou1
janv. 08
Doctor C
janv. 08
fati
févr. 08
Version Web
Réalisé par RedShift
no save