I have this piece of code from my teacher:
and I'm trying to understand how does he create this 2D array.
with the line
a=(float**)calloc(m,sizeof(float*));
I think that he allocates spaces for the lines.
The lines that I don't really understand is
a[0]=(float*)malloc(m*n,sizeof(float));
and the for loop.
Wouldn't a[0] contain an array of size m*n? What's the point in that? Shouldn't a[0] contain an array of size n, which would represent the column, then a[one] (if I write 1 instead of one it will create a link to the same photo again) another array of size n, and so on?