I have a generic pointer cause I need to work with different data types (uint8_t, int, float)
now I initialize it
Code:
uint8_t flag[8];
iter_first = &flag[4];
till now it's OK. but now I want to set a value and I should decide the size of the value.
Code:
int size = sizeof(iter_first);
if (size == 1)
(*((uint8_t *)iter_first)) = iter_first_val;
else
(*((int *)iter_first)) = iter_first_val;
size always 4 so I override all the bunch flag[4] - flag[7].
and if I try to cast
Code:
(uint8_t *)iter_first = &flag[4];
I get - Error[Pe137]: expression must be a modifiable lvalue
What do I miss?