I have the following variables:
#define X ... ... code unsigned char pin[X] = { ... }; // there are values here, no 0xFF ... struct { unsigned char pin[X]; } info;
and I need to copy the values from pin into info.pin. However, even direct assignment doesn't change the info.pin values. i.e.:
info.pin[0] = pin[0]; info.pin[1] = pin[1]; info.pin[2] = pin[2]; ... info.pin[X - 1] = pin[X - 1];
the watch window shows info.pin values are still 0xFF and indeed when another code that needs info.pin checks (after the assignment above of course), the values are still 0xFF. What do I have to do to make the values copied?
Same variable names (sigh!!).
The other way around is to use pointers.
> The other way around is to use pointers. No, that doesn't work either. When I said "even direct assignment..." that means I've tried every high level possibility. First I use a copy function, then pointer + loop, copy to local array first (this time the value gets copied, but still fails when copying values from local array to the array in the struct), finally I use direct assignment.