title: Pointer to lowest address in memory
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/1001307/detecting-endianness-programmatically-in-a-c-program">Detecting endianness programmatically in a C++ program</a>  </p>
  </blockquote>
  
  
  
  <p>I'm trying to check if I'm running a little or big endian OS.</p>
  
  <pre><code>int main()
  {
      int i = 1; 
      unsigned char b = i; 
      char *c = reinterpret_cast&lt;char*&gt;(&amp;i); // line 5
  
      cout &lt;&lt; "Processor identified as: " &lt;&lt; endl;
  
      if (*c == b) 
          cout &lt;&lt; "Little endian" &lt;&lt; endl;
      else
          cout &lt;&lt; "Big endian" &lt;&lt; endl;
  }
  </code></pre>
  
  <p>I'm not sure if casting an <code>int*</code> to <code>char*</code> pointer in line 5 is guaranteed to return a lowest address. Am I doing it right?</p>