drksssh a écrit :
Bonjour, je débute sous linux et j'ai un problème avec GCC quand je fais le typedef suivant:
typedef struct noeud {} *Arbre;
typedef struct noeud { Arbre droit;
Arbre gauche;
Char *mot; } Noeud;
|
Cette syntaxe marche très bien à la fac wink
|
Ca m'étonnerait, ou alors ce n'est pas un compilateur C.
Citation :
Mais la gcc me dit: Erreur: Redefinition of 'struct noeud'.
Peut être qu'il connaît pas le type struct en fait.
|
Normal. On ne peut pas définir 2 fois un typedef avec le même alias.
typedef struct noeud Arbre;
struct noeud { Arbre *droit;
Arbre *gauche;
Char *mot;
};
<...>
Arbre *Noeud;
|
Message édité par Emmanuel Delahaye le 09-01-2006 à 23:55:37
---------------
Des infos sur la programmation et le langage C: http://www.bien-programmer.fr Pas de Wi-Fi à la maison : http://www.cpl-france.org/