I have the following nested struct definition in my .h file:
struct PARAM
{
uint8_t data1;
uint8_t data2[2];
uint8_t data3[2];
};
struct CONFIG
{
uint8_t data4;
struct PARAM par1;
struct PARAM par2;
};
In my main.c file I declare the following array:
struct CONFIG settings[100];
and I try to initialize the first element as follows:
settings[0].data4 = 0x01;
settings[0].par1 = {0x01,{0x01,0x01},{0x05,0x06}};
settings[0].par2 = {0x01,{0x01,0x01},{0x05,0x06}};
But I get the following error for the setting[0].par1 line:
Expected expression.
Does anyone know what I am doing wrong?