array of pointers to arrays???? C/C++
Posted: Thu Dec 23, 2010 10:20 pm
Okay. I have 9 character arrays (to reduce memory consumption), each [2][12][12]. I would like to have an array of pointers to those arrays, and use it to pass a specific one of those arrays to a function.
I have tried many things as far as syntax goes.
I'm getting the following errors:
in other configuretions (guessing), I got:
Any ideas? I would really rather this not be a 4d array, although that may be an option. I'd also rather NOT rewrite the whole program to use pointers with explicit address arithmetic.
Thanks,
Chris
I have tried many things as far as syntax goes.
Code: Select all
void optimize(unsigned char parameter[2][12][12] );
//for the sake of this, lets assume that all these arrays are declared and initialized.
int main()
{
unsigned char *large_tables[9]={&spark_table, &fuel_start_table, &fuel_duration_table, &water_start_table,
&water_duration_table, &intake_phasing_table, &intake_duration_table,
&exhaust_phasing_table, &exhaust_duration_table};
optimize(*large_tables[subsystem]);
}
void optimize(unsigned char parameter[2][12][12] )
{
// do stuff
}
Code: Select all
warning: array subscript has type 'char'
error: call of overloaded 'optimize(unsigned char&)' is ambiguous
Code: Select all
cannot convert char (*)[2][12][12] to 'char' in initialization
invalid conversion from 'char' to char (*)[2][12][12]'
Thanks,
Chris