title: what does it mean to convert int to void* or vice versa?
body: <p>What does it mean to convert an integer value to a <code>void*</code> or viceversa from a memory point of view?
  My understanding is <code>void*</code> is an address to a block of memory of unspecified length.<br>
  This seems to be something like comparing apple with oranges.</p>
  
  <pre><code>int myval = 5;
  void* ptr = (void*)myval;
  printf("%d",(int)ptr);
  </code></pre>
  
  <p>I realized that I should have given the exact context where this is used. </p>
  
  <pre><code>int main(int argc, char* argv[]) {
  long       thread;  /* Use long in case of a 64-bit system */
  pthread_t* thread_handles; 
  
  /* Get number of threads from command line */
  if (argc != 2) Usage(argv[0]);
  thread_count = strtol(argv[1], NULL, 10);  
  if (thread_count &lt;= 0 || thread_count &gt; MAX_THREADS) Usage(argv[0]);
  
  thread_handles = malloc (thread_count*sizeof(pthread_t)); 
  
  for (thread = 0; thread &lt; thread_count; thread++)  
    pthread_create(&amp;thread_handles[thread], NULL, Hello, (void*) thread);  
  
  printf("Hello from the main thread\n");
  
  for (thread = 0; thread &lt; thread_count; thread++) 
    pthread_join(thread_handles[thread], NULL); 
  
  free(thread_handles);
  return 0;
  }  /* main */
  
  /*-------------------------------------------------------------------*/
  void *Hello(void* rank) {
  long my_rank = (long) rank;  /* Use long in case of 64-bit system */ 
  
  printf("Hello from thread %ld of %d\n", my_rank, thread_count);
  
  return NULL;
  }  /* Hello */
  </code></pre>
  
  <p>This code is from Peter Pachecho's book on Parallel programming.</p>