Is it possible to query the compiler to determine how many elements in an const String array or do I need to manually count them.
In Arduino with a esp8266 target i declare this 2D const String array
const String strButtonStates[][10] {
{"Jerky Dryer", "Yogurt Maker", "Egg Incubate", "Black Garlic", "Solder Reflow", "Solder Iron"},
{"Toggle Scale °C", "Toggle Scale °F"},
{"Run PID Loop", "Forced High", "Forced Low", "Forced MCV"},
{"Active High", "Active Low"},
{"Inject Water", "Auto Humidty", "Water Inhibit"},
{"Active High", "Active Low"},
{"Save State"},
{"Reset Restart"}
};
I would like the compiler to tell me that there are 6 elements in the first array 2 in the second and so on.
something like this would be nice
int n0 = sizeof(strButtonStates[0])
but it always returns 12
Perhaps there is a better way entirely that saves me having to define another array like this
byte buttonStates[8][2] = {
{0, 6},
{0, 2},
{0, 4},
{0, 2},
{0, 3},
{0, 2},
{0, 1},
{0, 1}
};
The first column records the current user selection, the second column records how many options there are for that button.
Any ideas or suggestions warmly welcome.
Ornea