[code]
#include <stdio.h>
#include <stdlib.h>
typedef
struct poste
{
long info ;
struct poste *fg, *fd ;
} poste ;
typedef poste *ptr_poste ;
void ajout_poste(ptr_poste *p, long val)
{
if(*p == NULL)
{
*p= malloc(sizeof(poste)) ;
*p.info= val ;
*p->fg= NULL ;
*p->fd= NULL ;
}
elseif(val < *p->info)
{
ajout_poste(&(*p->fg), val) ;
}
else
{
ajout_poste(&(*p->fd), val) ;
}
}
int main()
{
ptr_poste MonArbre ;
ajout_poste(&MonArbre, 10) ;
system("pause") ;
return0 ;
}[/code]
Bon, j'ai recopié un code qui paraîssait sans histoire sur le papier sauf qu'à la compilation j'ai le droit à ces messages :
gcc main.c -o main.exe
main.c: In function `ajout_poste':
main.c:18: error: request for member `info' in something not a structure or union
main.c:19: error: request for member `fg' in something not a structure or union
main.c:20: error: request for member `fd' in something not a structure or union
main.c:22: error: request for member `info' in something not a structure or union
main.c:24: error: request for member `fg' in something not a structure or union
main.c:28: error: request for member `fd' in something not a structure or union
make: *** [main.exe] Error 1
Une âme charitable pouraît-elle me sortir de ce mauvais pas ?
Merci d'avance
Nikö