Sorry by my 'C' is a bit rusty in this area.
I have several arrays of pointers to function. e.g.
void (*DataLoggerFunctions[])(void) =
{
&logData,
&binaryToCsv,
&openBinFile,
&testSensor
};
and
void (*MainMenuFunctions[])(void) =
{
&doTremorStimulation,
&DisplayDataLoggerMenu
};
all functions are void func(void);
I need an array of these arrays and the syntax to call any individual function.
The first representation is an array of pointers to arrays which can be of different length and from the encompassing array you can’t know how many elements are in each subarrays.
The second representation is a 2D array of pointers. Each line and column have the same number of elements
Advantage of the first representation is saving memory especially if the arrays can have very different lengths at the cost of a possibly more difficult/ error prone iteration through those arrays as you’ll need special attention to the indexes to not go beyond the bounds of the subarrays.
Advantage of the second version is that it’s easy to traverse and you recognize an empty cell because it holds a nullptr
People do that for templates because it makes sense, it could be long line, even a simple one is long, but it makes no sense moving void or int or any other return type to another line. To be different? Sure there are thousands other ways to format your code that would enrage onlookers
?
since i preface my code examples with "consider" suggesting an approach but not necessarily a solution, and in this particular case since its from my laptop, wanted to suggest from where is might be integrated into an Arduino program
Thank you all for your contributions. The solution proposed by jfjlaros simplifies my data structures and simplifies my code accessing these functions.