title: endianess test and type casting
body: <p>I've known that to test the endianness, I can do following:</p>
  
  <pre><code>bool IsLittleEndian(){
  
     int a = 1;
  
     char* ptr = (char*)&amp;a;
  
     return *ptr;
  }
  </code></pre>
  
  <p>My question is why we can't just cast <code>int</code> to <code>char</code> instead of <code>int*</code> to <code>char*</code> above, like this.</p>
  
  <pre><code>int a = 1;
  
  char c = (char)a;
  </code></pre>
  
  <p>Is this also OK? Otherwise, what's the reason we can't do this? </p>