title: How do the operators < and > work with pointers?
body: <p>Just for fun, I had a <code>std::list</code> of <code>const char*</code>, each element pointing to a null-terminated text string, and ran a <code>std::list::sort()</code> on it. As it happens, it sort of (no pun intended) did not sort the strings. Considering that it was working on pointers, that makes sense.</p>
  
  <p>According to the <a href="http://www.cplusplus.com/reference/stl/list/sort/" rel="noreferrer">documentation</a> of <code>std::list::sort()</code>, it (by default) uses the <code>operator &lt;</code> between the elements to compare.</p>
  
  <p>Forgetting about the list for a moment, my actual question is: How do these (>, &lt;, >=, &lt;=) operators work on pointers in C++ and C? Do they simply compare the actual memory addresses?</p>
  
  <pre><code>char* p1 = (char*) 0xDAB0BC47;
  char* p2 = (char*) 0xBABEC475;
  </code></pre>
  
  <p>e.g. on a 32-bit, little-endian system, <code>p1</code> > <code>p2</code> because <code>0xDAB0BC47</code> > <code>0xBABEC475</code>?</p>
  
  <p>Testing seems to confirm this, but I thought it'd be good to put it on StackOverflow for future reference. C and C++ both do some <a href="https://stackoverflow.com/questions/4111495/why-is-there-an-implicit-type-conversion-from-pointers-to-bool-in-c">weird things</a> to pointers, so you never really know...</p>