i am writing a simple function that accepts an int and a 2d array. the function looks for the first row that has only zeros and prints the index of that row. if theres no row of zeros theres is no output. this is what i came up with. also. i am getting an error 'incompatible implicit declaration of built-in function ‘printf’ when i try to complie. any help would be apprciated. i am not even sure this is a correct way to achieve this goal.
Code:
void allZero (int n, int a[n][n]) {
int sum = 0;
int i,j,x;
for(i=0;i<n;i++)
{
if (a[i][0] == 0)
{
x = i;
for(j=0;j<n;j++)
{
sum += a[i][j];
}
}
else
{ if(a[i][0] ==0)
return;
}
if (sum == 0)
{
printf("%d",x);
}
else
{
if (!sum==0)
{
return;
}