Having trouble with this - I know I've written way too much code but I can't figure out what different to do...

RGB is a containing the red green and blue

Code:

void blur(int height, int width, RGB image[height][width])
{
for (int i = 0; i < height; i++)
{
for (int j = 0; j < width; j++)
{
//0,0
float red1 = image[i][j].rgbtRed;
float green1 = image[i][j].rgbtGreen;
float blue1 = image[i][j].rgbtBlue;
//0,1
float red2 = image[i][j + 1].rgbtRed;
float green2 = image[i][j + 1].rgbtGreen;
float blue2 = image[i][j + 1].rgbtBlue;
//0,2
float red3 = image[i][j + 2].rgbtRed;
float green3 = image[i][j + 2].rgbtGreen;
float blue3 = image[i][j + 2].rgbtBlue;
//1,0
float red4 = image[i + 1][j].rgbtRed;
float green4 = image[i + 1][j].rgbtGreen;
float blue4 = image[i + 1][j].rgbtBlue;
//1,1
float red5 = image[i + 1][j + 1].rgbtRed;
float green5 = image[i + 1][j + 1].rgbtGreen;
float blue5 = image[i + 1][j + 1].rgbtBlue;
//1,2
float red6 = image[i + 1][j + 2].rgbtRed;
float green6 = image[i + 1][j + 2].rgbtGreen;
float blue6 = image[i + 1][j + 2].rgbtBlue;
//2,0
float red7 = image[i + 2][j].rgbtRed;
float green7 = image[i + 2][j].rgbtGreen;
float blue7 = image[i + 2][j].rgbtBlue;
//2,1
float red8 = image[i + 2][j + 1].rgbtRed;
float green8 = image[i + 2][j + 1].rgbtGreen;
float blue8 = image[i + 2][j + 1].rgbtBlue;
//2,2
float red9 = image[i + 2][j + 2].rgbtRed;
float green9 = image[i + 2][j + 2].rgbtGreen;
float blue9 = image[i + 2][j + 2].rgbtBlue;
float averageRed = red1 + red2 + red3 + red4 + red5 + red6 + red7 + red8 + red9;
float averageGreen = green1 + green2 + green3 + green4 + green5 + green6 + green7 + green8 + green9;
float averageBlue = blue1 + blue2 + blue3 + blue4 + blue5 + blue6 + blue7 + blue8 + blue9;
averageRed = averageRed / 9;
averageGreen = averageGreen / 9;
averageBlue = averageBlue / 9;
image[i][j].rgbtRed = roundf(averageRed);
image[i][j].rgbtGreen = roundf(averageGreen);
image[i][j].rgbtBlue = roundf(averageBlue);