title: double ** a = malloc() works in c but not in cuda?
body: <p>I've written a program which works in C but won't compile in CUDA for some reason.</p>
  <p>The issue arises here:</p>
  <pre><code>int key_size = 1000;
  
  int references = 40;
  
  double **ref_ptr;
  
  ref_ptr = malloc(references * sizeof *ref_ptr);    
  for(int i = 0; i&lt;references;i++){
      ref_ptr[i] = malloc(key_size * sizeof *ref_ptr[i]);
  }
  </code></pre>
  <p>In C this program compiles just fine, it even compiles with NVCC as a C program (nvcc my_program.c). But when I try to compile it as a CUDA program I get this error.</p>
  <pre><code>main.cu(191): error: a value of type &quot;void *&quot; cannot be assigned to an entity of type &quot;double **&quot;
  main.cu(193): error: a value of type &quot;void *&quot; cannot be assigned to an entity of type &quot;double *&quot;
  </code></pre>
  <p>I tried casting them as pointers but this began creating a lot of memory access issues for me, and my program works perfectly otherwise when compiled in C. Could you help me think through what could be going on here?</p>