I can't find why it doesn't work. That's the error message: index 600 out of bounds for type 'RGBTRIPLE [width] And I think it makes half reflection and half stays the same...
That's my code:
// Reflect image horizontally
void reflect(int height, int width, RGBTRIPLE image[height][width])
{ RGBTRIPLE copy[height][width];
//Temporary copy of the array
for (int i = 0; i < height; i++)
{
for (int j = 0; j < width; j++)
{
copy[i][j].rgbtRed = image[i][j].rgbtRed;
copy[i][j].rgbtGreen = image[i][j].rgbtGreen;
copy[i][j].rgbtBlue = image[i][j].rgbtBlue;
}
}
//Reflect
for (int i = 0; i < height; i++)
{
for (int j = 0; j < width; j++)
{
image[i][j].rgbtRed = copy[i][width - 1 - j].rgbtRed;
image[i][j].rgbtGreen = copy[i][width - 1 - j].rgbtGreen;
image[i][j].rgbtBlue = copy[i][width - 1 - j].rgbtBlue;
}
}
return;
}