The function fun(int**,int) below is called by main() to produce a
matrix according to the input number m(2<=m<=0).Please study examples
below and correct the error in the program.
Note: main() is not allowed to be madified.And do not add or remove any
line of the program.
Example of expected Input and Output:
input is :2 | If input is :4
Output is: | Output is:
1 2 | 1 2 3 4
2 4 | 2 4 6 8
| 3 6 9 12
| 4 8 12 16
#include<stdio.h>
#include<conio.h>
#define M 10
int a[M][M]={0};
fun(int**a,int m)
{ int j,k;
for(j=0;j<m;j++)
a[j][k]=k*j;
}
main()
{int i,j,n;
printf("Enter n:");scanf("%d",&n);
fun(a,n);
for(i=0;i<n;i++)
{ for j=0;j<n;j++)
printf("%4d",a[i][j]);
printf("\n");
}
}
找错误