Ce qui m´étonne, c´est que le programme compile alors que tu assignes une chaine "moussa" a un char. es tu sur de ne pas avoir mis de char* dans ta structure ?
ça expliquerait des choses.
petite correction proposée (version C):
- include <stdio.h>
- include <stdlib.h>
- include <string.h>
typedef struct identite identite;
struct identite
{
char prenom[30];
char nom[30];
long age;
};
int main(int argc, char *argv[])
{
identite moussa;
strcpy(moussa.prenom,"Moussa");
strcpy(moussa.nom,"Raser");
moussa.age = 20;
printf("%s %s %ld", moussa.prenom, moussa.nom, moussa.age);
system("PAUSE");
return 0;
}
petite correction proposée (version C++):
- include <stdio.h>
- include <stdlib.h>
- include <string>
using namespace std;
typedef struct identite identite;
struct identite
{
string prenom;
string nom;
long age;
};
int main(int argc, char *argv[])
{
identite moussa;
moussa.prenom = "Moussa";
moussa.nom = "Raser";
moussa.age = 20;
printf("%s %s %ld", moussa.prenom.c_str(), moussa.nom.c_str(), moussa.age);
system("PAUSE");
return 0;
}
PS : humour, le "raser" 