I've seen all the other questions and answers regarding this specific error. Thankfully, or not so, my error was not due to the order in which I looped through the image. Here's my code:
void grayscale(int height, int width, RGBTRIPLE image[height][width])
{
for (int i = 0; i < height; i++)
{
for (int j = 0; i < width; i++)
{
int avg = round((image[i][j].rgbtRed + image[i][j].rgbtGreen + image[i][j].rgbtBlue) / 3.0);
image[i][j].rgbtRed = avg;
image[i][j].rgbtGreen = avg;
image[i][j].rgbtBlue = avg;
}
}
// iterate through row
// iterate through each pixel in the row
// calculate average rgb value
// change values to average (rounded to nearest int)
return;
}
Previous posts used i for width and j for height, creating the problem. Even though that wasn't the issue, I tried reversing the order and I didn't get the error message but the program still wouldn't work. I also use 3.0 instead of 3 to make the division a float to be able to round it. I'm not quite sure what else to do, hopefully one of you knows.