title: Compilation difference C and C++
body: <p>I have a piece of code which looks like</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;netdb.h&gt;
  #include &lt;arpa/inet.h&gt;
  
  
  int main(int argc, char *argv[])
  {
      struct hostent *server;
      server = gethostbyname(argv[1]);
      struct in_addr * address=(in_addr * )server-&gt;h_addr;
          fprintf(stderr,"[%d] [%s] server [%s] \n",__LINE__,__func__,inet_ntoa(*address));
  }
  </code></pre>
  
  <p>When i use g++ compiler it gets compiled but the same gives the following error with gcc compiler</p>
  
  <pre><code>myclient.c: In function ‘main’:
  myclient.c:10:31: error: ‘in_addr’ undeclared (first use in this function)
  myclient.c:10:31: note: each undeclared identifier is reported only once for each function it appears in
  myclient.c:10:41: error: expected expression before ‘)’ token
  </code></pre>
  
  <p>Am I missing something here?</p>