title: Code to find Endianness-pointer typecasting
body: <p>I was trying to search for a code to determine the endianness of the system, and this is what I found:</p>
  
  <pre><code>int main()
  {
      unsigned int i= 1;
      char *c = (char *)&amp;i;
      if (*c) {
          printf("Little Endian\n");
      } else {
          printf("Big Endian\n");
      }
  }
  </code></pre>
  
  <p>Could someone tell me how this code works? More specifically, why is the ampersand needed here in this typecasting :</p>
  
  <pre><code>char *c = (char *)&amp;i;
  </code></pre>
  
  <p>What is getting stored into the pointer c.. the value i contains or the actual address i is contained in? Also why is this a char for this program?</p>