The section of function is never entered in the following code
please help me out!
#include<stdio.h>
int findMax(int *a[], int m, int n)//this function is not entering
{
int i,j,k=0;
for(i=0;i<m;i++)
for(j=0;j<n;j++)
if(k<a[i][j])
k=a[i][j];
printf("hi");//this hi is also not printing
//this hi is just for testing
return k;
}
//This function correct it if possible
int main()
{
int m,n,a[50][50],i,j,k=0;
printf("Enter the number of rows in the matrix
");
scanf("%d",&m);
printf("Enter the number of columns in the matrix
");
scanf("%d",&n);
printf("Enter the elements in the matrix
");
for(i=0;i<m;i++)
for(j=0;j<n;j++)
{
scanf("%d",&a[i][j]);
}
printf("The matrix is");
for(i=0;i<m;i++)
{
printf("
");
for(j=0;j<n;j++)
printf("%d ",a[i][j]);
}
k=findMax((int **)a,m,n);//statements after this is never running but no
//compilation errors
printf("
The maximum element in the matrix is %d",k);
return 0;
}
please help me out!!
Thanks to you in advance!!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…