I would like to execute something like the following code, but I keep getting a warning for levels of indirection.
It is my understanding that in the following,
int Array1[5];
int Array2[2][4];
int *pointer1 = Array1;
int *pointer2 = Array2;
all 4 examples have the level of indirection of (int*)
.
But it seems like no matter what combination of the following ideas I try to compile the code, I get indirection warnings:
void loadIntArrayData(int size, int *buffer);
void passArrayIntoThisFunction(char count, int *structure){ //idea 1
void passArrayIntoThisFunction(char count, int **structure){ //idea 2
void passArrayIntoThisFunction(char count, int structure[][3]){ //idea 3
loadIntArrayData(3*count*sizeof(int), structure); //idea 1
loadIntArrayData(3*count*sizeof(int), &(structure[0][0])); //idea 2
loadIntArrayData(3*count*sizeof(int), &(structure[0])); //idea 3
loadIntArrayData(3*count*sizeof(int), structure[0]); //idea 4
}
int main(void){
passArrayIntoThisFunction(2, (int[][3]){{1,2,3},{4,5,6}});
//I want to have a multi-level array ^ here ^ for readability
return 0;
}
Could someone explain levels of indirection when it comes to multi-dimensional arrays?
Here is the warning (small variations depending on which combination used):
'function': 'int *' differs in levels of indirection from 'int[2][3]'