Non capisco dov'è l'errore:
enum x {VERDE,GIALLO,ROSSO,BLU};
struct square {
x variabile1; /* Syntax error before x */
x variabile 2;
};
Non capisco dov'è l'errore:
enum x {VERDE,GIALLO,ROSSO,BLU};
struct square {
x variabile1; /* Syntax error before x */
x variabile 2;
};
Devi utilizzare typedefcodice:enum x {VERDE,GIALLO,ROSSO,BLU}; typedef enum x x; struct square { x variabile1; x variabile2 ; };
http://programmazione.html.it/guide/...i-avanzati-ii/
Experience is what you get when you don’t get what you want
Ora dice:
[Warning] useless keyword or type name in empty declaration
l'uguale dopo enum x?
non ho capito...
che compilatore usi ?
gcc lo ha compilato correttamente
Experience is what you get when you don’t get what you want
codice:typedef enum {VERDE,GIALLO,ROSSO,BLU} Colore; struct square { Colore variabile1; Colore variabile2 ; };
No MP tecnici (non rispondo nemmeno!), usa il forum.
io ho
enum x {VERDE,GIALLO,ROSSO,BLU};
E quindi?Originariamente inviato da starcraftworld
io ho
enum x {VERDE,GIALLO,ROSSO,BLU};
No MP tecnici (non rispondo nemmeno!), usa il forum.
Ma è uguale alla soluzione che ho proposto io o ci sono differenze ? (typedef non è mai stato il mio forte)
Experience is what you get when you don’t get what you want