title: inet_pton with all zero ip address
body: <p>I am using inet_pton  to verify if the input IP address is valid and is not all zeros ( 0.0.0.0 or 00.00.0.0).</p>
  
  <pre><code>inet_pton(int af, const char *src, void *dst)
  </code></pre>
  
  <p>If the input ip (src) address is 0.0.0.0 inet_pton set dst to value 0.  If src value is 00.00.00.00 , dst value is not 0, but I get a random value for each trail.  Why inet_pton convert 0.00.00.00 to value 0 </p>
  
  <pre><code>#include &lt;string.h&gt;
  #include &lt;arpa/inet.h&gt;
  
  void main( int argc, char *argv[])
  {
      int s;
      struct in_addr ipvalue;
  
      printf("converting %s to network address \n", argv[1]);
      s = inet_pton(AF_INET, argv[1], &amp;ipvalue);
  
      if(s &lt; 0)
              printf("inet_pton conversion error \n");
  
      printf("converted value = %x \n", ipvalue.s_addr);
  }
  </code></pre>
  
  <p><strong>Sample Runs</strong></p>
  
  <p>Correct values:</p>
  
  <pre><code>./a.out 10.1.2.3
  converting 10.1.2.3 to network address
  converted value = 302010a
  </code></pre>
  
  <p></p>
  
  <pre><code>./a.out 0.0.0.0
  converting 0.0.0.0 to network address
  converted value = 0
  </code></pre>
  
  <p>Incorrect results:</p>
  
  <pre><code>./a.out 00.00.00.0
  converting 00.00.00.0 to network address
  converted value = **a58396a0**
  </code></pre>
  
  <p></p>
  
  <pre><code>./a.out 00.0.0.0
  converting 00.0.0.0 to network address
  converted value = **919e2c30**
  </code></pre>