I was looking through the filter.c file in the pset4-filter-less and I want to understand the theory behind the declaration of array as shown below:

RGBTRIPLE(*image)[width] = calloc(height, width * sizeof(RGBTRIPLE));

I think calloc is allocating height no. of boxes of size width each. I want to understand the part on the left hand side.


It is a array of pointers to RGBTRIPLEs.The name is image will have total width number of pointers.Calloc is allocating height no. of boxes, each of size width times size of a RGBTRIPLE and it also initialises values to zero.

If this answered your question, please click the tick mark.

| improve this answer | |

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .