I seem to recall a discussion on this in the past, but cannot find it.
I want to put an array of structs into flash. (but flash or EEPROM or SRAM shouldn't matter, I don't think) Each has a name field of exactly 8 bytes. I want to give initial value, with no trailing null. CodeVision objects:
Error: C:\OptiCode\HY148\HY148p.c(4660): initializer "string" exceeds array dimension
Stripped-down trivial example (yeah, I know if there were no other fields I could just paste them together...)
struct xproduct_struct { unsigned char type; // unsigned char name[8]; // }; typedef struct xproduct_struct xxxProduct; flash xxxProduct products_fixed[] = { { 1, "DICTATE "}, { 2, "FROGHAIR"}, };
I guess I could init each element of the array individually -- that would be onerous:
{ 2, {'F','R','O','G','H','A','I','R'}},