title: Transparently swapping pointers to character arrays in C++
body: <p>I have a 2D character array:<br>
  <code>char nm[MAX1][MAX2] = { "john", "bob", "david" };</code><br>
  I want to swap two of these elements (without <code>std::swap</code>) by simply writing<br>
  <code>swapPointers(nm[0], nm[1]);</code><br>
  where <code>swapPointers</code> looks like this  </p>
  
  <pre><code>void swapPointers(char *&amp;a, char *&amp;b)  
  {  
      char *temp = a;  
      a = b;  
      b = a;  
  }
  </code></pre>
  
  <p>However, this does not compile (and while adding casts makes it compile, the pointers end up pointing to wrong/weird locations).  </p>
  
  <p>Can anybody help?<br>
  Thanks!</p>