im getting the error on the threads name whenever a try to access an attribute of a struct
here is the relevant code
the structure
Code:
typedef struct logrw_struct_ {
unsigned int num_reg, num_bks, bks_sz;
unsigned int pos_livre;
blocks_t* bks_a, *bks_i;
blocks_t* regs[0];
}logrw_struct_t;
initializing the structure
Code:
logrw_struct_t* logrw_init(unsigned int num_reg, unsigned int array_dim, unsigned int bloco_dim) {
int i;
logrw_struct_t *log = (logrw_struct_t*)
malloc(sizeof(logrw_struct_t) + num_reg);
log->num_reg = num_reg;
log->num_bks = array_dim;
log->bks_sz = bloco_dim;
log->bks_a = block_new(array_dim, bloco_dim);
log->bks_i = block_new(array_dim, bloco_dim);
for(i = 0; i<num_reg; i++){
log->regs[i] = log->bks_a;
}
log->pos_livre = i;
return log;
}
the main where i get the error
Code:
int main(){
logrw_struct_t *log;
log = logrw_init(2, 12, 4);
printf("registos->%d\nnum_blocos->%d\n", log->num_registos, log->num_blocos);
return 0;
}