D16 Answer


/* Puzzle D16 -- Zero the edges of an Array
|
| Change the elements of the outer rows and
| columns of an array to zero. Leave all other
| elements unaffected.
|
*/
int zeroEdges ( int x[][NUMCOLS], int nrows )
{
  int j;
  /* row 0 */
  for ( j=0; j<NUMCOLS; j++ ) x[0][j] = 0;

  /* row nrows-1 */
  for ( j=0; j<NUMCOLS; j++ ) x[nrows-1][j] = 0;

  /* column 0 */
  for ( j=0; j<nrows; j++ ) x[j][0] = 0;

  /* column NumColumns-1 */
  for ( j=0; j<nrows; j++ ) x[j][NUMCOLS-1] = 0;
}