Je veux rendre mon code plus facile à lire, donc je veux remplacer un grand ensemble de structures, par quelque chose de plus expressif, mais il ne compile pas.Définir typedef à l'intérieur d'une structure
typedef float vec_t;
typedef vec_t vec3_t[3];
typedef struct{
int x;
vec3_t point;
} structure1;
//This Works just fine and is what i want to avoid
structure1 structarray[] = {
1,
{1,1,1}
};
//This is what i want to do but dont work
//error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
structarray[0].x = 1;
structarray[0].point = {0,0,0};
int main()
{
//This is acceptable and works
structarray[0].x = 1;
//but this dont work
//GCC error: expected expression before '{' token
structarray[0].point = {1,1,1};
}
Pourquoi ne compile-t-il pas?
Rafe, Merci d'avoir corrigé les erreurs de sorts, essayez de ne pas refaire la même erreur. – banana