Function, struct or class? I am trying to learn more about arduino programming, and recently i've written functions for randomizing and then modifying a single array. Now i'd like to do the same for four individual arrays. This is where i'm getting stuck. My questions:

Am i right to assume that it's not possible calling a function for multiple individual arrays?

Perhaps a separate question, but if a class or struct would be more suitable for multiple instances, what are the major differences worth considering to choose the right approach?
Are you trying to use the same function for different arrays at different times, or are you trying to use a function that handles four different arrays at the same time?

If the former, you'd write something like

void myfunc( T *arr, size_t size ) // where T is the type of the array
{
  for ( size_t i = 0; i &lt; size; i++ )
    arr[i] = some_new_value();
}


then call it for each array:

T arr1[N];  // where T is int, float, double, whatever
T arr2[M];
T arr3[O];
T arr4[P];

myFunc( arr1, N );
myFunc( arr2, M );
myFunc( arr3, O );
myFunc( arr4, P );


This assumes all the arrays have the same base type (e.g., they're all arrays of int).

If you want a function to work on four arrays simultaneously, you'd write it as

void myFunc( T *a1, size_t a1_size,
             T *a2, size_t a2_size,
             T *a3, size_t a3_size,
             T *a4, size_t a4_size )
{
  // code for handling each array
}


While I wrote it such that all the arrays have the same type, it doesn't have to be this way.  Each array can be a different type (a1 can be int, a2 can be double, etc.).