I have two multidimensional arrays
uint8_t arr1 [24][8];
uint8_t arr2 [24][8];
I am writing a function to print out the contents of these arrays, and I wish to specify to the function which of the arrays I want printed. I tried the following:
void print_array(int n) {
uint8_t arr[24][8];
if (n == 1) {
arr = arr1;
}
else if (n == 2) {
arr = arr2;
}
// ... code to print "arr" contents ...
}
Basically, I want to be able to copy the reference to the multidimensional array to avoid having duplicated code to print the array contents. The above gives me an 'invalid array assignment' error. What do I need to do to copy the array reference successfully?