VS is giving me an error with the line:
int seam[Image_height(img)];
and I don't really understand why? I need a fresh array each time I run the loop and it's size is defined by the height of the image I am passing in. I included the function that it is calling as well.
int Image_height(const Image* img) {
return img->height;
}
void horizontal_carve(Image *img, int newWidth) {
...
int offset = Image_width(img) - newWidth;
for (int i = 0; i < offset; ++i) {
int seam[Image_height(img)];
//do stuff with seam...
}
}
Could someone explain why I get the error
function call must have a constant value in a constant expression
(in particular, highlighting "Image_height(img)") and what I could do to fix it? Thanks!