I have this struct:
struct ChangeIntItem
{
char *unit;
const char **parser;
int *changevalue;
uint16_t *change_eeprom_value;
int maximum;
int minimum;
};
I want to initialize other variables with this struct-Variable:
struct ChangeIntItem ChangeIntItemTypeBoolean = { .unit = "", .minimum = 0, .maximum = 1, .parser = {"off", "on"}};
It is working fine but I get some warnings:
Severity Code Description Project File Line
Warning braces around scalar initializer Handsteuerung C:\Users\... 11
Severity Code Description Project File Line
Warning (near initialization for 'ChangeIntItemTypeBoolean.parser') Handsteuerung C:\Users\... 11
Severity Code Description Project File Line
Warning initialization from incompatible pointer type Handsteuerung C:\Users\... 11
Severity Code Description Project File Line
Warning (near initialization for 'ChangeIntItemTypeBoolean.parser') Handsteuerung C:\Users\... 11
Severity Code Description Project File Line
Warning excess elements in scalar initializer Handsteuerung C:\Users\... 11
Severity Code Description Project File Line
Warning (near initialization for 'ChangeIntItemTypeBoolean.parser') Handsteuerung C:\Users\... 11
In another case I wrote a function which sets the variables of the struct to default-values but I prefer this method because its much shorter.
All mistakes where caused by '.parser = {"off", "on"}' but I don't get my mistake...