Structure Initialization
Up to R8C/Tiny
I 've this structs definition
typedef struct
{
byte p;
byte q;
byte *msg;
}Ta;
typedef struct
{
byte m;
word n;
Ta oM;
}Tb;
byte t [3] ;
and create an array of TB's struct and initialize this array in the following way:
const Tb tbArray[1] = { 1,0xFFFF, {0, 1 , t}};
but the compiler sent me this message : "invalid initializer"
the question : what is the right way to initialize the array?
ok, here is more info... I was trying to use a variable to initialize the array
const Tb tbArray[1] = { 1,0xFFFF, {0, aux , t}};
where aux is a variable defined in somewhere... so I can't do that
There is no problem in the first case that you sent.
But in the second one, any compiler will give you an error message. You can only initialize a variable with constants.
So why don't you pass the aux's default value to initial value of tbArray[0].oM.q ?

