In my main I call this function add
like this:
add(a,b,c,row,col);
Its definition is given below:
void add(int **a,int **b,int **c,int row,int col)
{
int i,j;
for(i=0;i<row;i++)
{
for(j=0;j<col;j++)
{
c[i][j]=a[i][j]*b[i][j];
}
}
}
The main function:.......
int main()
{
int c[5][5],i,j;
int **f;
int a[5][5],b[5][5],row,col;
printf("Enter row : ");
scanf("%d",&row);
printf("Enter column : ");
scanf("%d",&col);
printf("Enter matrix A :\n");
for(i=0;i<row;i++)
{
for(j=0;j<col;j++)
{
scanf("%d",&a[i][j]);
}
}
printf("Enter matrix B :\n");
for(i=0;i<row;i++)
{
for(j=0;j<col;j++)
{
scanf("%d",&b[i][j]);
}
}
add(a,b,c,row,col);
printf("Addition :\n");
for(i=0;i<row;i++)
{
for(j=0;j<col;j++)
{
printf("%d\t",c[i][j]);
}
printf("\n");
}
getch();
return 0;
}
The errors given by compilers:
||warning: command line option '-Wzero-as-null-pointer-constant' is valid for C++/ObjC++ but not for C [enabled by default]| C:\Users\Amir Khasru\Desktop\matrix_add.c|5|warning: no previous declaration for 'add' [-Wmissing-declarations]| C:\Users\Amir Khasru\Desktop\matrix_add.c||In function 'main':| C:\Users\Amir Khasru\Desktop\matrix_add.c|45|error: passing argument 1 of 'add' from incompatible pointer type| ||=== Build failed: 1 error(s), 2 warning(s) (0 minute(s), 0 second(s)) ===|