vediamo se ho capito bene...
scrivere typedef struct abc{
...
};
significa che poi posso creare una struttura di tipo abc nel seguente modo?
abc struttura2;
??
vediamo se ho capito bene...
scrivere typedef struct abc{
...
};
significa che poi posso creare una struttura di tipo abc nel seguente modo?
abc struttura2;
??
In C (non in C++) non e' cosi'. Devi scrivere
typedef struct nodoBin {
...
} NodoBin;
e puoi scrivere
NodoBin n;
o anche
typedef struct {
...
} NodoBin;
e va bene sempre
NodoBin n;
uno degli stili piu' chiari che ho visto è:
a questo punto:codice:typedef struct _TuaStruttura TuaStruttura struct _TuaStruttura { int a; float b; ..... };
codice:TuaStruttura *qualcosa;
PyGTK GUI programming
un impegno concreto: eliminare la k dalle tastiere italiane
puoi fare anche cosi:
typedef int index;
struct list{
int *buffer;
index head;
index tail;
index size;
};
int main (void){
struct list l;
.
.
.
}
In effetti lo "stile" adottato per dichiarare un nuovo tipo di dati strutturato e un puntatore a tale tipo, e' il seguente
codice:typedef struct _NUOVODATO { int a; } NUOVODATO, *PNUOVODATO; int main(void) { NUOVODATO struttura; PNUOVODATO pstruttura; struttura.a = 0; pstruttura=&struttura; return 0; }
Potresti fare cosi':
struct Struttura
{
..Struttura_vars..
};
Struttura *StrPtr;
StrPtr = new Struttura;
StrPtr -> Struttura_vars;
Bye