I have to make a 4x4 matrix, then load the main diagonal with zeros and show it, so that finally I count the multiples of 5 in it. I want to send the matrix by reference , in order to modify the original from the diagonalpp function. It is important to note that no I am allowed to declare global variables . I throw this error and I have tried many things and I can not solve it.
#include<stdio.h>
#include<time.h>
#include<stdlib.h>
void diagonalPP (int* m[][4]);
int multiplos (int* m[][4]);
int main()
{
int f,c,mul, m[4][4];
for (f=0;f<4;f++)
{
for (c=0;c<4;c++)
{
scanf("%d",& m[f][c]);
}
}
for (f=0;f<4;f++)
{
for (c=0;c<4;c++)
{
printf("%d", m[f][c]);
printf("\t");
}
printf("\n");
}
diagonalPP (m[4][4]);
for (f=0;f<4;f++)
{
for (c=0;c<4;c++)
{
printf("%d", m[f][c]);
printf("\t");
}
printf("\n");
}
mul= multiplos (m);
printf("La cantidad de multiplos de 5 es:%d",mul);
}
void diagonalPP (int* m[][4])
{
for (int f=0;f<4;f++)
{
for (int c=0;c<4;c++)
{
if (f==c)
{
*m[f][c]=0;
}
}
}
}
int multiplos (int* m[][4])
{
int cont=0;
for (int f=0;f<4;f++)
{
for (int c=0;c<4;c++)
{
if (m[f][c]%5==0)
{
cont ++;
}
}
}
return cont;
}