Aah. You are absolutely right. Sorry about that. I had it like this char name[10];
But still I'm having a problem
error: incompatible types in assignment of 'const char [10]' to 'char [11]'
Using the String class is a crutch...don't use it; it uses more memory than need be. Try something like:
typedef struct NAMELIST
{
char name[10]; // Change
int deviceID;
}; NAMELIST nameList[5];
And fill in the data to it like this.
strcpy(nameList[0].name, "FIRSTNAME"); // Change
nameList[0].deviceID = 0x01;
Check your pre/post change file sizes to see how much memory you can save.
strncpy(nameList[0].name, "FIRSTNAME", 10);
// or, if a 0 char should always be there (init .name[9] = 0 once)
strncpy(nameList[0].name, "FIRSTNAME", 9);
In a program which is in need of saving RAM and the strings being constants, I'd also consider to hold the strings as PROGMEM constants instead of using variables in RAM for constant text.
If the names are constant, I would suggest using a pointer to a PROGMEM string in the struct,
the fixed length field limits the maximum namelength and wastes space (for all shorter names).
The pointer methode wastes 2 bytes for the counter in each entry.
But als always, you don't get something for nothing.