Pagina 1 di 3 1 2 3 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 21

Discussione: Struttura C

  1. #1

    Struttura C

    Non capisco dov'è l'errore:

    enum x {VERDE,GIALLO,ROSSO,BLU};

    struct square {
    x variabile1; /* Syntax error before x */
    x variabile 2;
    };

  2. #2
    codice:
    enum x {VERDE,GIALLO,ROSSO,BLU};
    
    typedef enum x x;
    
    struct square 
    {
         x variabile1;
         x variabile2 ;
    };
    Devi utilizzare typedef
    http://programmazione.html.it/guide/...i-avanzati-ii/
    Experience is what you get when you don’t get what you want

  3. #3
    Ora dice:
    [Warning] useless keyword or type name in empty declaration

  4. #4
    Utente di HTML.it
    Registrato dal
    Oct 2008
    Messaggi
    13
    l'uguale dopo enum x?

  5. #5
    non ho capito...

  6. #6
    che compilatore usi ?
    gcc lo ha compilato correttamente
    Immagini allegate Immagini allegate
    Experience is what you get when you don’t get what you want

  7. #7
    Utente di HTML.it L'avatar di oregon
    Registrato dal
    Jul 2005
    residenza
    Roma
    Messaggi
    36,480
    codice:
    typedef enum {VERDE,GIALLO,ROSSO,BLU} Colore;
    
    struct square 
    {
         Colore variabile1;
         Colore variabile2 ;
    };
    No MP tecnici (non rispondo nemmeno!), usa il forum.

  8. #8
    io ho
    enum x {VERDE,GIALLO,ROSSO,BLU};

  9. #9
    Utente di HTML.it L'avatar di oregon
    Registrato dal
    Jul 2005
    residenza
    Roma
    Messaggi
    36,480
    Originariamente inviato da starcraftworld
    io ho
    enum x {VERDE,GIALLO,ROSSO,BLU};
    E quindi?
    No MP tecnici (non rispondo nemmeno!), usa il forum.

  10. #10
    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

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.