title: When is casting void pointer needed in C?
body: <p>I've been looking at <em>Advanced Linux Programming</em> by Mitchell, Oldham and Samuel. I've seen in the section on pthreads something about void pointers and casting that confuses me.</p>
  
  <p>Passing an argument to pthread_create(), they don't cast the pointer to a void pointer even though that is what the function expects. </p>
  
  <pre><code>pthread_create( &amp;thread, NULL, &amp;compute_prime, &amp;which_prime );
  </code></pre>
  
  <p>Here, <em>which_prime</em> is of type <em>int</em>. </p>
  
  <p>But taking a value returned from the thread using pthread_join, they DO cast the variable to void pointer.</p>
  
  <pre><code>pthread_join( thread, (void*) &amp;prime );
  </code></pre>
  
  <p>Here, <em>prime</em> is of type <em>int</em> again.</p>
  
  <p>Why is casting done in the second instance and not in the first?</p>