I am running a code to generate kernel or matrix. I see it works, but it is not clear to me how. Author of the code declares the ret as pointer to float. But I see he uses it as array:
The difference between array and pointer is that array has memory allocated for its elements, but pointer does not. Pointer may be null, point to object, or point to object (that happens to be in array of objects of same type).
Your ret is set to point to float object that happens to be the first in an array of size^2 floats.
keskiverto:
I thought that the float size is fixed. So when he declares float* ret;
so it should point to object of size sizeof(float). Hence I am surprised, that it is possible to change the size of the object to sizeof(float) * size * size ... it sounds strange to me, like redeclaration. If you declare you will use variable A with size of 12 bytes for example, and then you change the size of the variable to e.g 64 bytes, it does not make sense to me.