title: Reversing a '\0' terminated C string in place?
body: <p>I have some conceptual questions about reversing a null terminated C string, and clarification questions about the nature of pointers.</p>
  
  <p>The input might be </p>
  
  <pre><code>char arr[] = "opal";
  </code></pre>
  
  <p>and the code:</p>
  
  <pre><code>void reverse(char *str) {  /* does *str = opal or does *str = o since the pointer str is type char? */
  
      char* end  = str; /* what is the difference between char* end and char *end? and is *end pointing to opal now? */
  
      char tmp;
  
      if (str) {  /* if str isn't null? */
          while (*end) 
              ++end; 
      }
      --end; /* end pointer points to l now */
  
      while (str &lt; end) {     /* why not *str &lt; *end? is this asking while o &lt; l? */
          tmp = *str; /* tmp = o */
  
          *str++ = *end; /* what is the difference between *str++ and ++str? does *str++ = l? */
          *end-- = tmp; /* *end points to o */
          }
      }
  }
  </code></pre>