I have this code:
void checkmat(float *** mat,float * max,float * min){
float sum=0,sum2=0,flag=1;
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
sum+=(*mat[i][j]);
sum2+=(*mat[j][i]);
}
if(sum>(*max))
(*max)=sum;
if(flag){
(*min)=sum;
flag=0;
}
if(sum2<(*min))
(*min)=sum2;
sum=0;
sum2=0;
}
}
int main(){
float mat[n][n]={{1,2,3,4},{5,6,7.6,8},{9,1,2.9,3},{4,5,6,7}};
float min=0,max=0;
checkmat(&mat,&max,&min);
printf("%f is max %f is min \n",max,min);
}
For now, it doesn't really matter what the code does. I'm interested in why I get this error message from the compiler:
test3.c: In function ‘main’:
test3.c:38:10: warning: passing argument 1 of ‘checkmat’ from incompatible pointer type [-Wincompatible-pointer-types]
checkmat(&mat,&max,&min);
^
test3.c:8:6: note: expected ‘float ***’ but argument is of type ‘float (*)[4][4]’
void checkmat(float *** mat,float * max,float * min){
Any ideas?