in Arduino C++ I have the following struct:
struct acceptedCommand {
String Command;
int switchcase;
};
Then I initialise an Array of the above struct like this:
const acceptedCommand acceptedCommands[] = {
{"set-amountofcells", 1},
{"set-cell-min-voltage", 2},
{"set-cell-max-voltage", 7}
...
};
Desired result: I want to dynamically return the number of elements in this array.
What I already tried: I cannot use the SizeOf function because this returns only the total amount of bytes used of the array.
I also cannot divide the value returned by SizeOf by the size of the struct because the size of each element of the array is different (because of the different length of the string).
So how can I get the number of elements in the acceptedCommands[] array dynamically?