Hello everyone,
I find C not very flexible this time because I know there is an easy way to assign field values to a struct like this :
Struct mine = { field1, field2, ... };
but in my case "mine" is contained in a bigger struct. So I have to assign let's say a field named data but it seems I cannot do :
parent->data = { field1, field2, ... };
Moreover data in my case is an array to full with these Struct. I wish I could simply do :
unsigned int i = 0;
parent->data[i++] = { field1, field2, ... };
parent->data[i++] = { field1, field2, ... };
// etc...
Is there any nice way to do it in C ? I can't understand why there is this kind of limitation ! The type are specified, there isn't any pointer but only memory assignment to do. Note that these fieldN are hard coded. Thank you.