title: pthread passing object as argument to pthread_create
body: <p>For the given program ::</p>
  
  <pre><code>void start(void *n){
    Node *obj = (Node *)n;
    cout &lt;&lt; obj -&gt; val;
  }
  
  int   
  main(int argc, char *argv[])
  {
    int i,n;
    cin &gt;&gt; n;
    Node *nodeObj;
    nodeObj = new Node[n];
    pthread_t *p = new pthread_t[n];
    for(i=0;i&lt;n;i++){
      pthread_create(&amp;p[i],NULL,start,(void *)(nodeObj[i]));   /*ERROR HERE in arg pass*/
    }                                                                               
    return 0;   
  }
  </code></pre>
  
  <p>I get the following error::</p>
  
  <blockquote>
    <p>invalid conversion from ‘void (<em>)(void</em>)’ to ‘void* (<em>)(void</em>)’</p>
  </blockquote>
  
  <p>I basically want to send each of the object <code>NodeObj[0]</code> , <code>NodeObj[1]</code> , <code>NodeObj[2]</code> ... to each of the new threads I create. the start function is where each of the threads start.</p>