我有这个结构:
struct ChangeIntItem
{
char *unit;
const char **parser;
int *changevalue;
uint16_t *change_eeprom_value;
int maximum;
int minimum;
};
Run Code Online (Sandbox Code Playgroud)
我想用这个struct-Variable初始化其他变量:
struct ChangeIntItem ChangeIntItemTypeBoolean = { .unit = "", .minimum = 0, .maximum = 1, .parser = {"off", "on"}};
Run Code Online (Sandbox Code Playgroud)
它工作正常,但我收到一些警告:
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\... …Run Code Online (Sandbox Code Playgroud)