title: How do I convert a Python list into a C array by using ctypes?
body: <p>If I have the follow 2 sets of code, how do I glue them together?</p>
  
  <pre><code>void
  c_function(void *ptr) {
      int i;
  
      for (i = 0; i &lt; 10; i++) {
          printf("%p", ptr[i]);
      }
  
      return;
  }
  
  
  def python_routine(y):
      x = []
      for e in y:
          x.append(e)
  </code></pre>
  
  <p>How can I call the c_function with a contiguous list of elements in x?  I tried to cast x to a c_void_p, but that didn't work.  </p>
  
  <p>I also tried to use something like </p>
  
  <pre><code>x = c_void_p * 10 
  for e in y:
      x[i] = e
  </code></pre>
  
  <p>but this gets a syntax error. </p>
  
  <p>The C code clearly wants the address of an array.  How do I get this to happen?</p>