title: My CS50 blur function isn't working correctly
body: <p>I'm currently working on the filter program on CS50. While it has been easy enough so far, I'm struggling with a few errors on my blur program. I feel like the issue lies in the edge cases of the program but I can't be sure. If someone could provide a hint I'd be very grateful.</p>
  
  <pre><code>// Blur image
  void blur(int height, int width, RGBTRIPLE image[height][width])
  {
      RGBTRIPLE copy[height][width];
  
      for (int h = 0; h &lt; height; h++)
      {
          for (int w = 0; w &lt; width; w++)
          {
              copy[h][w] = image[h][w];
          }
      }
  
      for (int y = 0; y &lt; height; y++)
      {
          for (int x = 0; x &lt; width; x++)
          {
              int count = 0;
              float redaddup = 0;
              float greenaddup = 0;
              float blueaddup = 0;
              for (int r = -1; r &lt; 2; r++)
              {
                  for (int s = -1; s &lt; 2; s++)
                  {
                      if((y + r &gt; height || y + r &lt; 0) || (x + s &gt; width || x + s &lt; 0))
                      {
  
                      }
                      else
                      {
                          redaddup += copy[y+r][x+s].rgbtRed;
                          greenaddup += copy[y+r][x+s].rgbtGreen;
                          blueaddup += copy[y+r][x+s].rgbtBlue;
                          count++;
                      }
                  }
              }
              image[y][x].rgbtRed = round(redaddup / count);
              image[y][x].rgbtGreen = round(greenaddup / count);
              image[y][x].rgbtBlue = round(blueaddup / count);
  
              image[y][x].rgbtRed = image[y][x].rgbtRed % 256;
              image[y][x].rgbtBlue = image[y][x].rgbtBlue % 256;
              image[y][x].rgbtGreen = image[y][x].rgbtGreen % 256;
          }
      }
      return;
  }
  </code></pre>
  
  <p>The errors I'm receiving are:</p>
  
  <pre><code>:( blur correctly filters 3x3 image
  expected "70 85 95\n80 9...", not "70 85 95\n80 9..."
  :( blur correctly filters 4x4 image
  expected "70 85 95\n80 9...", not "70 85 95\n80 9..."
  </code></pre>
  
  <p>Additionally, i'm fairly new to programming so if anyone fancies critiquing my code feel free to. I could use the feedback.</p>