title: Imitate/emulate a big-endian behavior in C?
body: <p>I was wondering if it's possible to emulate a big-endian behavior, for testing purpose? </p>
  
  <p>via either windows or linux , mingw or gcc. Here's a sample of code which I would like the emulation to return big endian:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;string.h&gt;
  
  #include &lt;limits.h&gt;
  #if CHAR_BIT != 8
  #error "Unsupported char size for detecting endianness"
  #endif
  
  int main (void)
  {
    short int word = 0x0001;
    char *byte = (char *) &amp;word;
    if (byte[0]) printf("little endian");
    else printf("big endian");
    return 0;
  }
  </code></pre>