The code:
int (*2d_array)[width] = calloc(height, width * sizeof(int));
Below is the distribution code from an online class, where RGBTRIPLE is a struct. Someone said image is a pointer to an array of length width of RGBTRIPLE. And so 2d_array
here is also a pointer to another array of integers who has width
number of elements?
RGBTRIPLE(*image)[width] = calloc(height, width * sizeof(RGBTRIPLE));
I am just really confused about this syntax. How does the parenthesis change the meaning of image? How should I interpret RGBTRIPLE(*image)[width]
? From left to right?
Any help is greatly appreciated!!!