typedef char tCadena[TCAD];
typedef struct{
int i;
int f;
tCadena cola[TCOL];
}tCola;
typedef struct{
tCadena nombre[TCAD];
int numfich;
tCola cola;
}tImpresora;
typedef struct{
tImpresora impresora;
int ocupado;
}tElementoImpresora;
typedef tElementoImpresora tablaImp[MAXIMP];
So I have these structs, and I have a variable called thing
of type tablaImp
I want to go inside the struct and set the i
of the first structure to 0
. I tried with:
tablaImp thing;
thing.impresora.cola.i=0;
But it tells me that its not a part of the structure. How can I do to go inside the first structure ? Thanks.
tablaImp
is an array, you need to index it.
for (i = 0; i < MAXIMP; i++) {
thing[i].impresora.cola.i = 0;
}
thing
is an array (of structs), and you're trying to use it as if it were a struct:
typedef tElementoImpresora tablaImp[MAXIMP];
tablaImp thing;
thing.impresora.cola.i=0;
/* ↑ need an array index here */
typedef tElementoImpresora tablaImp[MAXIMP];
tablaImp thing;
thing.impresora.cola.i=0;
thing
is an array, you need to specify the array element:
thing[0].impresora.cola.i = 0
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.