*When I call the user defined function, I receive the following error:`
error: invalid types ‘double[unsigned int]’ for array subscript
44 | C[i][j]=0;
...
The user defined code:
void Matrix(const double * A, const double *B, double * C){
for(unsigned int i=0;i < 4;i++)
{
for(unsigned int j=0;j < 4;j++)
{
C[i][j]=0;
for(unsigned int k=0;k < 4;k++)
{
C[i][j]+=A[i][k]*B[k][j];
}
}
}
}
Any help would be really appreciated.
C
is of typedouble*
. ThenC[i]
is adouble
. ThenC[i][j]
doesn't make sense. – Igor Tandetnikdouble* C
is a pointer to an array ofdouble
s. If your code wants to interpret it as a matrix, it's up to that code to compute appropriate offsets into that array for each element. – Igor Tandetnik