why do we have to pass a pointer to a pointer to cudaMalloc
17:56 21 Mar 2012

The following codes are widely used for GPU global memory allocation:

float *M;
cudaMalloc((void**)&M,size);

I wonder why do we have to pass a pointer to a pointer to cudaMalloc, and why it was not designed like:

float *M;
cudaMalloc((void*)M,size);

Thanks for any plain descriptions!

cuda