title: void function return (NULL)
body: <p>I am looking at a C client-server program and encountered this problem. The compiler complains that the function "return with a value, in function returning void".</p>
  
  <p>My question is, what is the point of returning (NULL) as opposed to simply return? Is this perhaps to avoid the caller from getting garbage back?</p>
  
  <pre><code>void *ThreadMain(void *threadArgs)
  {
      int clntSock;                   /* Socket descriptor for client connection */
  
      /* Guarantees that thread resources are deallocated upon return */
      pthread_detach(pthread_self()); 
  
      /* Extract socket file descriptor from argument */
      clntSock = ((struct ThreadArgs *) threadArgs) -&gt; clntSock;
      free(threadArgs);              /* Deallocate memory for argument */
  
      HandleTCPClient(clntSock);
  
      return (NULL);
  }
  </code></pre>