struct S {
int x;
char str[16];
};
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
// (1) This would be the desired way: simple and compact, but doesn't work
S s1={12, "Hello2"};
Serial.println(s1.str);
// (2) Instead, this appears the correct way to do, but it is ugly and cumbersome for bigger strings
S s2={.x=25, .str = {'H','e','l','l','o', '1'}};
Serial.println(s2.str);
S s3={.x=12};
strcpy(s3.str, "Hello3");
Serial.println(s3.str);
}
void loop() {
// put your main code here, to run repeatedly:
}