
two bytes of memory getting trashed
I wrote some code to allow the user to select parameters using the NXT buttons. It uses an array of structs (TParam) inside one struct (TParams).
All was good except the first two bytes of the first string in the TParam struct was getting trashed ("Blue" became "|3ue"). I could shift the problem to a different variable by changing the order of the variables in the struct typedef, e.g. putting string name first instead of string values[].
I resorted to inserting a sacrificial variable as the first variable in TParam (short dummy). But I am not comfortable with this. Is it me or is it RobotC?
Here's the pair of typedefs that are in menu.c. Enclosed are menu.c and another file that can be used to demo the problem. Comment out "short dummy" to see the problem.