title: ntohl() vs htonl() in Little Endian
body: <p>Kindly clarify my doubt as i got so confused with the below stuff and i couldnt get a 
      clean anwser any where else on net.</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  int main()
  {
     int a = 0x44332211;
     printf("Network - 0x%x\n", htonl(a));// Host to network
     printf("Host    - 0x%x\n", ntohl(a));// Network to host
     return 0;
  }
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code> Network - 0x11223344   
   Host    - 0x11223344  
  </code></pre>
  
  <p>Here <code>htonl(0x44332211)</code> => i am converting little endian(LE) to BE. So output will be <code>0x11223344</code>. That i understood. My problem is with <code>ntoh()</code>. Now <code>ntohl(0x44332211)</code> => what?</p>
  
  <p>Here i am executing both the commands on 1 terminal. So  host to  network, ie <code>hton()</code> means my terminal to network. That makes sense. But here <code>ntohl()</code> means what? <code>ntohl()</code> comes into picture if we have:</p>
  
  <pre><code>a PC A----(ie hton)sending data over network------&gt;(ie ntoh) to PC B?
  </code></pre>
  
  <p>Also <code>ntoh</code> expects a network byte order ie Big endian. Kindly intepret what <code>ntohl()</code> means above and why its  printed same as <code>0x11223344</code> and why not <code>0x44332211</code>?</p>