Auto load arguments for function from array

I have function that takes 5 arguments.

I have a large array that holds the arguments in sets of 5. Like this - I have just shown for 3 sets

float param[100] = {  2,0.5,4.5,0.0,5.0
                                     2,4.5,0.5,0.0,5.0
                                     3,2.5,2.5,0.0,5.0 };

So the function inside the loop() will use the first set of arguments , complete something and then will need to fetch the next set of 5 arguments and work on that, till the complete set of arguments are used up.

Will be happy to get some ideas to do this.

Why not use a two dimensional array?

Not quite like that I hope. You have commas missing

I agree with AWOL. Use a 2 dimensional array, or just pretend that it is a 2 dimensional array and do this

float param[100] = {2, 0.5, 4.5, 0.0, 5.0,
                    2, 4.5, 0.5, 0.0, 5.0,
                    3, 2.5, 2.5, 0.0, 5.0
                   };

void setup()
{
  Serial.begin(115200);
  for (int set = 0; set < 3; set++)
  {
    for (int member = 0; member < 5; member++)
    {
      Serial.print(param[set * 5 + member]);
      Serial.print("\t");
    }
    Serial.println();
  }
}

void loop()
{
}

Honestly never thought of that ! Let me try and work on it !! Thanks

Thanks ... yes this is possible when i know beforehand the number of data sets. Maybe I need to tweak this to exit the loop upon meeting a particular end marker character ! Maybe a float that is way out of the expected data range .

There is no way to make an array of constants WITHOUT knowing the number of data sets.

float param[][5] =
{
  {2, 0.5, 4.5, 0.0, 5.0},
  {2, 4.5, 0.5, 0.0, 5.0},
  {3, 2.5, 2.5, 0.0, 5.0}
};
size_t paramCount = sizeof param / sizeof param[0];

void setup()
{
  Serial.begin(115200);
  for (size_t set = 0; set < paramCount; set++)
  {
    for (size_t member = 0; member < 5; member++)
    {
      Serial.print(param[set][member]);
      Serial.print("\t");
    }
    Serial.println();
  }
}

void loop()
{
}

If I find myself passing five arguments to a function, I start thinking of ways to reduce that number. It's far too easy in a language like C++ that doesn't have named arguments to accidentally swap arguments.

Consider passing a struct or a class as a parameter and using a array of structs/classes instead.