I am trying to check my code using check50 but it gives me the error
But when I am compiling it and running it from the terminal it runs just fine.
My code for helper.c is
#include "helpers.h"
// correct the value
int correct(float color);
// Convert image to grayscale
void grayscale(int height, int width, RGBTRIPLE image[height][width])
{
// Loop over height
for (int i = 0; i < height; i++)
{
// loop over the width
for (int j = 0; j < width; j++)
{
// Find avg of RGB colors of the pixel and then round off
int gray_color = round((image[i][j].rgbtBlue + image[i][j].rgbtGreen + image[i][j].rgbtRed) / 3.0);
image[i][j].rgbtBlue = gray_color;
image[i][j].rgbtGreen = gray_color;
image[i][j].rgbtRed = gray_color;
}
}
return;
}
// Convert image to sepia
void sepia(int height, int width, RGBTRIPLE image[height][width])
{
// loop over height
for (int i = 0; i < height; i++)
{
// loop over the width
for (int j = 0; j < width; j++)
{
// copy of original color of the pixel
RGBTRIPLE copy = image[i][j];
// Set value using the formula provided
image[i][j].rgbtRed = correct((0.393 * copy.rgbtRed) + (0.769 * copy.rgbtGreen) + (0.189 * copy.rgbtBlue));
image[i][j].rgbtGreen = correct((0.349 * copy.rgbtRed) + (0.686 * copy.rgbtGreen) + (0.168 * copy.rgbtBlue));
image[i][j].rgbtBlue = correct((.272 * copy.rgbtRed) + (.534 * copy.rgbtGreen) + (.131 * copy.rgbtBlue));
}
}
return;
}
// Reflect image horizontally
void reflect(int height, int width, RGBTRIPLE image[height][width])
{
// Array of original width pixels
RGBTRIPLE copy[width];
// loop over height
for (int i = 0; i < height; i++)
{
// loop over the width
for (int j = 0; j < width; j++)
{
// copy of original width
copy[j] = image[i][j];
}
// loop over width from the back
for (int j = width - 1; j >= 0; j--)
{
// reverted width
image[i][j] = copy[width - (j + 1)];
}
}
return;
}
// Blur image
void blur(int height, int width, RGBTRIPLE image[height][width])
{
// 2d Array copy of orignal image
RGBTRIPLE copy[height][width];
// Copy image array to copy array
for (int i = 0; i < height; i++)
{
for (int j = 0; j < width; j++)
{
copy[i][j] = image[i][j];
}
}
// loop over height
for (int i = 0; i < height; i++)
{
// loop over the width
for (int j = 0; j < width; j++)
{
// Array for neighboring pixel
RGBTRIPLE neighboring_pixel[9];
// Total neighbor possible
int total_neighbor = 0;
// loop over the height of square made of neighboring pixels
for (int k = -1; k < 2; k++)
{
// loop over the width of square made of neighboring pixels
for (int l = -1; l < 2; l++)
{
// Check for condition that is always true in possible pixel
if (((i + k) >= 0) && ((i + k) < height) && ((j + l) >= 0) && ((j + l) < width))
{
// copy neighbooring pixels to neighboring_pixel array from copy array
neighboring_pixel[total_neighbor] = copy[i + k][j + l];
// Increse posible neighboring by + 1 in total_neighbor
total_neighbor++;
}
}
}
// Variables for the sum of neighboring pixel colors
long r = 0;
long g = 0;
long b = 0;
// Summing all pixels colors
for (int z = 0; z < total_neighbor; z++)
{
r += neighboring_pixel[z].rgbtRed;
g += neighboring_pixel[z].rgbtGreen;
b += neighboring_pixel[z].rgbtBlue;
}
// Avg of neighboring pixel
image[i][j].rgbtRed = round(r / (float) total_neighbor);
image[i][j].rgbtGreen = round(g / (float) total_neighbor);
image[i][j].rgbtBlue = round(b / (float) total_neighbor);
}
}
return;
}
//Correct the color by returning 255 if greater than 255
int correct(float color)
{
if (color >= 255)
{
return 255;
}
return round(color);
}