First of all, I’ve carefully read through the “Multidimensional Array” thread. But I’m not sure if it applies to my situation…
I have to create a series of ~50 different one-dimensional arrays, each containing about 20 elements (instead of just a multidimensional array, due to the 255 array-element limit)
Based on the code below, what’s the best way to load the contents of one of these arrays (into current_array) by passing an argument (array_number) to a function (LoadArray)?
const char array1[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]
const char array2[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]
...
const char array50[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]
//////////////////////////////////////////////////////////////
// This function loads a sequence based on the
// argument that's passed to it
//////////////////////////////////////////////////////////////
void LoadArray(unsigned char array_number)
{
unsigned char i;
for (i = 0; i < 20; i++) {
current_array[i] = array1[i];
}
}
Or is there a totally different way of doing this?
thanks!