array address - Expression must be modifiable lvalue -
typedef struct state1_s { u8 size; u8 state; } state1_t; typedef struct state2_s { u8 size; u8 state[2]; } state2_t; typedef struct state3_s { u8 code; u8 count; }state3_t;
i have these 3 structures. when following
state1_t comp[8]; state2_t *avail; state3_t *health; &comp = (state1_t *)(&(avail->state[2])+1);
i expression must modifiable lvalue error.
i same error when
&comp = (state1_t *)(&(heaalth->count) +1);
how fix this? want address of comp @ end of 1 structure. how do that?
state1_t comp[8];
in declaration comp
array of 8 struct's state1_t
base address of array being comp
cannot modifiable. hence modifiable lvalue error when try changing address of comp
.
Comments
Post a Comment