title: Increment a char pointer in c++
body: <p>I am working on a question from Cracking the Coding Interview. The question is: Write code to reverse a C-Style String. 
  And here is the answer I got that is written in c++, but I don't understand the meaning behind increment a char pointer.</p>
  
  <pre><code>void swap(char &amp;a, char &amp;b){
      a = a^b;
      b = a^b;
      a = a^b;
  }
  
  void reverse1(char *s){
      if(!s) return;
      char *p = s, *q = s;
      while(*q) ++q;
      --q;
      while(p &lt; q)
          swap(*p++, *q--);
  }
  </code></pre>
  
  <p>The part that I don't understand is in the second function from the first while loop. What is the condition <code>*p</code>? And why increment <code>q</code> will chop off the starting character in the string?</p>
  
  <p>For example, if</p>
  
  <pre><code>char s[] = "1234567890";
  </code></pre>
  
  <p>After you pass <code>s</code> into function <code>reverse1</code>, why will <code>++q</code> give you a result like <code>"234567890"</code>?</p>