You cannot initialize fields inside a type definition. All initialization has to happen at the time of declaring a variable of the defined type:
typedef struct {
char fielda[ 2 ][ FIELD_A_MAX + 1 ];
bool fieldb;
bool fieldc;
sem_t fieldd;
} Set;
...
Set s = {.fieldb = false, .fieldc = false};
Unfortunately, the initializing sequence needs to be repeated each time. To avoid this, you could make a function to initialize Set
:
void init_Set(Set* s) {
s->fieldb = false;
s->fieldc = false;
...
}
Now the initialization code is in a single place. You need to invoke this code for each Set
structure that you allocate.