Type-casting void* to long
<p>Is it possible to directly type-caste a void pointer to long without causing a trouble? Below is a little code snippet I extracted from the code <a href="https://computing.llnl.gov/tutorials/pthreads/" rel="nofollow">here</a> (Example under <em>Pthread Joining</em> section of the page).</p>

<pre><code>{
    void *status;
    long t;
    rc = pthread_create(&amp;thread[t], &amp;attr, BusyWork, (void *)t);
    rc = pthread_join(thread[t], &amp;status);
    printf("Main: completed join with thread %ld having a status of %ld\n",t,(long)status);
}
</code></pre>

<p>As <a href="http://man7.org/linux/man-pages/man3/pthread_join.3.html" rel="nofollow">this manual page</a> says that pthread_join() copies the exit status of the target thread (i.e., the value that the target thread supplied to pthread_exit()) into the location pointed to by *retval(*status in this case). But in the program I mentioned in question, status doesn't point to any location. Then how is it that the program still works? </p>

<p>And secondly,as far as my knowledge is concerned, status cannot hold a long value then how does typecasting status gives us a value which is long and not an address?</p>