title: Array of pointers in Cython
body: <p>I have the following <code>Cython</code> code (the syntax is based on the post <a href="https://stackoverflow.com/a/13983740/4189299">https://stackoverflow.com/a/13983740/4189299</a>):</p>
  
  <pre><code>from libc.stdlib cimport malloc, free
  
  def test_func():
      cdef int n = 10
      cdef char *array = &lt;char *&gt;malloc(n * sizeof(char*))
      for i in range(n):
          array[i] = NULL
      free(array)
  </code></pre>
  
  <p>It throws the compile-time error:</p>
  
  <pre><code>Error compiling Cython file:
  ------------------------------------------------------------
  ...
  
  def test_func():
      cdef int n = 10
      cdef char *array = &lt;char *&gt;malloc(n * sizeof(char*))
      for i in range(n):
          array[i] = NULL
                    ^
  ------------------------------------------------------------
  
  test.pyx:7:19: Cannot assign type 'void *' to 'char'
  </code></pre>
  
  <p>For some reason an array of <code>char</code> instead of <code>char*</code> is getting generated. Therefore, can anyone help me to obtain an array of <code>char*</code> in <code>Cython</code>?</p>