First of all: yes, I know this is a common topic and I've tried several proposed solutions. Nothing worked for me (at least nothing with "nice" code), I finally tried the way described here (2nd variant in jxh's solution): 2D array passing to a function
#include<stdio.h>
typedef double real32;
void Multiply_Matrix_Vector38(int n, int m, real32 A[n][m], real32 B[m], real32 Result[n]);
int main()
{
real32 A[3][8];
real32 B[8];
real32 Result[3][3];
int i;
for(i = 0; i < 8; i++) {
A[0][i] = i;
A[1][i] = i+1;
A[2][i] = i+2;
B[i] = i;
B[i] = i;
B[i] = i;
}
Multiply_Matrix_Vector(3, 8, A[3][8], B[8], Result[3]);
return 0;
}
void Multiply_Matrix_Vector(int n, int m, real32 A[n][m], real32 B[m], real32 Result[n])
{
uint8 i, j;
real32 sum;
sum = 0;
for(i = 0; i < n; i++ {
for(j = 0; j < m; j++) {
sum = sum + A[i][j] * B[j];
printf("A %f\n", A[i][j]);
}
Result[i] = sum;
sum = 0;
}
}
I still get incompatible type errors - how can this be fixed?