im having trouble compiling this,
Code:#include <stdio.h> #include <math.h> double matnorm1(double **A, int m, int n) { double norm=0.0; double temp; int x; int y; for (x=0; x<n; x++) { temp=0.0; for (y=0; y<m; y++) { temp=temp+fabs(A[y][x]); } if(temp>norm) norm=temp; } return(norm); } double matnorminf(double **A, int m, int n) { double norm=0.0; double temp; int x; int y; for (x=0; x<m; x++) { temp=0.0; for (y=0; y<n; y++) { temp=temp+fabs(A[x][y]); } if(temp>norm) norm=temp; } return(norm); } main() { double A[2][2]={{1.0,2.0},{3.0,4.0}}; printf("The matnorm1 is %g\n",matnorm1(A,2,2)); printf("The matnorminf is %g\n",matnorminf(A,2,2)); }
when i do i get the following error message-
hw2-3.c:44: error: cannot convert 'double (*)[2]' to 'double**' for argument '1' to 'double matnorm1(double**, int, int)'
hw2-3.c:45: error: cannot convert 'double (*)[2]' to 'double**' for argument '1' to 'double matnorminf(double**, int, int)'
and i have no idea how to correct this.
any help would be appreciated.



LinkBack URL
About LinkBacks


