I’m at work right now and I wanted to ask about a problem I had this morning.
I’m defining my pot config in structs like so.
typedef struct s_pots {
const unsigned char description[16];
const unsigned char param1;
const unsigned char type;
<etc..>
} pots;
const pots PotConfiguration[32] {
//description param1 type <etc…>
{“12345678abcdefgh”, 16, 2, <etc…>},
{“12345678abcdefgh”, 15, 2, <etc…>},
};
Later, the description is being passed onto MIOS_LCD_PrintCString() like so.
MIOS_LCD_PrintCString(PotConfiguration[pin].description);
I get an error when compiling for the ‘description’ const having too many elements.
the error goes away if I define description with 17 elements like so:
const unsigned char description[17];
I’m using a 2x16 LCD screen and it seems I should define the descriptions as being 16 in length.
I wipped out my old ‘C’ book and it looks like strings should have an additionalnull terminator. The book showed this: ‘\0’.
Is this my problem? Do I need to make my description one extra char longer? And if I do, how do I pass a null or ‘\0’ at the end of the string in my config above?
Thanks for everything… again.