2

Please note I haven't validated this with testing and have only glanced at your code, but one thing that stands out to me: round((float) (sum_blue / pixel_type)) Remember operator precedence here: the division will be performed first (as it is inside parentheses). At this point both values are integers so integer division will be performed and the remainder ...


1

This happens because the code is attempting to access an array element outside the bounds of the array. Remember that when an array is allocated a size of, say 5, the elements will run from 0 to 4. Height and width are array SIZES, so they each exceed the maximum allowable values by 1. As for the for loop that the code is using to initialize the array, I ...


1

Two problems with your code: First: The group of int variables 'sumRedx, sumGreenx' etc need to be declared before using them. As they are now, the code won't compile. Second: There is a misspell in your 'gx' array.


Only top voted, non community-wiki answers of a minimum length are eligible