Given the following struct typedefs...
typedef struct SubStruct_t {
const char *str2;
long l;
}
SubStruct;
typedef struct MyStruct_t {
int i;
float f;
SubStruct s;
const char *str1;
}
MyStruct;
The following static initilizers would create an array of 3, MyStruct items at compile-time.
MyStruct ms[] = {
{
10,
9.0,
{
"str2.0",
1000
},
"str1.0"
},
{
11,
9.1,
{
"str2.1",
1001
},
"str1.1"
},
{
12,
9.2,
{
"str2.2",
1002
},
"str1.2"
},
};