Find IP address of the machine in C?
<p>How do I get the IP address of the local machine in C on Windows? I was not able to get the IP address of my machine in the following code:</p>

<pre><code>#include &lt;ifaddrs.h&gt;
#include &lt;stdio.h&gt;

int main()
{
    struct ifaddrs *id;
    int val;
    val = getifaddrs(&amp;id);
    printf("Network Interface Name :- %s\n",id-&gt;ifa_name);
    printf("Network Address of %s :- %d\n",id-&gt;ifa_name,id-&gt;ifa_addr);
    printf("Network Data :- %d \n",id-&gt;ifa_data);
    printf("Socket Data : -%c\n",id-&gt;ifa_addr-&gt;sa_data);
    return 0;
}
</code></pre>

<p>I am facing an error while compiling:</p>

<blockquote>
  <p>fatal error C1083: Cannot open include file: 'net/if.h': No such file or directory.</p>
</blockquote>

<p>I cannot use <code>#include &lt;net/if.h&gt;</code> as it is only available on Linux.</p>