title: EXC_BAD_ACCESS occurred when assign char with a poitner
body: <p>EXC_BAD_ACCESS occurred in <code>*str++ = *end;</code>. What's wrong with this?</p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  int main() {
      char *hello = "abcdefgh";
      char c = 'c';
      char *str = hello;
      //printf("%s",str);
      char * end = str;
      char tmp;
      if (str) {
          while (*end) {
              ++end;
          }
          --end;
          while (str &lt; end) {
              tmp = *str;
              printf("hello:%s str:%c, end:%c\n", hello, *str, *end);
              *str++ = *end;
              *end-- = tmp;
  
          }
      }
  
      return 0;
  }
  </code></pre>