title: C - What does *(long *)(host->h_addr); do?
body: <p>I found the following code in <a href="https://aticleworld.com/ssl-server-client-using-openssl-in-c/" rel="nofollow noreferrer">this</a> example: </p>
  
  <pre><code>addr.sin_addr.s_addr = *(long *)(host-&gt;h_addr);
  </code></pre>
  
  <p><code>h_addr</code> is is a <code>char</code> pointer  and <code>host</code> is a pointer to a struct of type <code>hostent</code>. <code>addr</code> is a struct of type <code>sockaddr_in</code> and <code>sin_addr</code> is a struct of type <code>in_addr</code>. <code>s_addr</code> is a <code>uint32</code>.</p>
  
  <p>Most of this information can be found here: <a href="http://man7.org/linux/man-pages/man7/ip.7.html" rel="nofollow noreferrer">http://man7.org/linux/man-pages/man7/ip.7.html</a></p>
  
  <p>I'm pretty sure <code>(long)</code> casts the char to a long, but I don't know what the extra asterisks do, especially because <code>s_addr</code> is not a pointer. </p>
  
  <p>Can someone explain what is happening here?</p>