linux c, loop through 2d array?

I have a 2 d array that I need to loop through and check for a specific value in each variable...

Im a little confiused on how to do this...

#include stdio.h
#include string.h
main ()
{ char arrary[3][3];
  memset(array,' ',sizeof(array));
  
  for ?????
  { if ( array == ' ' )
    { do something...
    }
  }
}

Im not a C guy.. I generally use bash/perl and I would use a foreach/ or for loop for to do this. any help would be appreciated.

int a,b;

for(a=0; a<3; a++)
for(b=0; b<3; b++)
{
      printf("array[%d][%d]=%d\n", a, b, arr[a]);
}
1 Like

I believe Corona688 meant a++ instead of i++ in the outer for-loop's final expression.

Regards,
Alister

1 Like