News for hackers. Stuff that matters.
Re:Applying the Linus Torvalds “Good Taste” Coding Requirement by licorna on Wednesday October 26, 2016 @08:19AM (#12795823)
You can think of your grid array as a contiguous piece of memory. I would do:

  bzero(grid, sizeof(int) * COLS);
  bzero(grid + COLS * (ROWS - 1), sizeof(int) * COLS);

  for (int i=1; i < ROWS-1; i++) {
    *(grid + (i * COLS)) = 0;  /* set left col to 0 */
    *(grid + (i * COLS) + COLS - 1) = 0;  /* set right col to 0 */
  }

There are no comments on this comment yet.