Jp3141
Well-known member
I am trying to initialize an array as part of a structure variable, but the compiler options in place on Arduino seem to require that the array size is predefined. Is there a way around this ? Ultimately, different instances of my Key structs will have different lengths for the Pulse[] array and I don't want to reserve memory for the worst (longest) case.
Here is a very reduced version of my code;
Here is a very reduced version of my code;
Code:
struct Key {
char Name[8];
unsigned int Pulse[11]; // works
//unsigned int Pulse[]; // get compiler message about "too many initializers for 'unsigned int [0]'"
};
struct Key OnKey = {"On", {9070,4480, 610,530, 600,530, 610,520, 600,530, 00}};
void setup() {}
void loop() { }