Is there a way to pass 1D fixed array to 2D pointer functions. I can figure out passing 1D pointer arrays.
void prettyPrintMatrix_float(float **matrix, int rows, int cols){
int i, j;
for (i = 0; i<rows; i++){
for (j = 0; j<cols; j++){
printf("%10.3f", matrix[i][j]);
}
printf("\n");
}
return;
}
float myArray[10] = {0.0f};
float* myPointerArray = (float*)malloc(sizeof(float) * 10);
prettyPrintMatrix_float(&myPointerArray, 1, 10); // Works
prettyPrintMatrix_float(&myArray, 1, 10); // ERROR
prettyPrintMatrix_float(&(myArray[0]), 1 , 10); ERROR
So I can't think of a way to get around this. Only way I can think of is to create new function. Which I would rather not, if I don't have to.