While trying to understand some code in C++ I came across the following code (and trying to understand its meaning):
int SIZE = 256;
float* A = (float *) malloc(SIZE * sizeof(float*));
for (int i=0; i<M*K; i++) { A[i] = 0.0; }
I wanted to ask, how is the above different from the following:
float* A = (float *) malloc(SIZE * sizeof(float));
When I compile the code, both of the versions of "float* A=" compile and execute ok.