Bonjour,
J'ai un code qui ne fonctionne pas, quelqu'un sait pourquoi ?
typedef struct Personne Personne;
struct Personne
{
char nom[100];
char prenom[100];
char adresse[100];
long age[4];
char sexe[1];
};
void initialiserJoueur(Personne *joueur[nbr]);
int main(int argc, char *argv[])
{
Personne joueur[nbr];
initialiserJoueur(&joueur[nbr]);
long i = 0;
for ( i = 0 ; i < 2 ; i++)
{
printf("joueur %ld\n", i+1);
printf("Quel est votre nom ? ");
scanf("%s", joueur[i].nom);
printf("Quel est votre prenom ? ");
scanf("%s", joueur[i].prenom);
printf("Quel est votre adresse ? ");
scanf("%s", joueur[i].adresse);
printf("Quel est votre age ? ");
scanf("%ld",&joueur[i].age);
printf("Quel est votre sexe ? (M ou F)");
scanf("%s", joueur[i].sexe);
printf("%s %s, adresse : %s, %ld ans, de sexe %s\n\n", joueur[i].nom, joueur[i].prenom, joueur[i].adresse, *joueur[i].age, joueur[i].sexe);
}
system("PAUSE");
return 0;
}
void initialiserJoueur(Personne *joueur[nbr])
{
(*joueur).nom = "";
(*joueur).prenom = "";
(*joueur).adresse = "";
(*joueur).age = 0;
(*joueur).sexe = "";
}
L'ordi il m'affiche :
In function 'main':
[Warning] passing arg 1 of 'initialiserJoueur' from incompatible pointer type
In function 'initialiserJoueur'
request for member 'nom' in someting not a structure or union
request for member 'prenom' in someting not a structure or union
request for member 'adresse' in something not a structure or union
request for member 'age' in something not a structure or union
request for member 'sexe' in someting not a structure or union
[Build Error] [main.o] Error 1
C'est quoi un "pointer type" ? et pourquoi il me met "not a structure or union" ?
Toute réponse bienvenue ; Merci d'avance.
Configuration: Windows XP