title: How to reverse a string array in place using a swap function and pointers? (C++)
body: <p>my assignment is to reverse a string array in place. I must use a swap function that swaps individual characters and this swap should be in a loop. Pass two character pointers to the swap function to manipulate the locations in memory. So here is what I have so far: </p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  void swap(char *a, char *b){ //swap function that accepts two char     pointers
      char temp = *a;          
      *a = *b;                 
      *b = temp;
  }
  
  
  int main()
  {
      char array[5] = {'H','e','l','l','o'}; //string hello
      char *start = array[0]; //pointer for start of string
      char *end = array[array.length-1]; //pointer for end of string
      for (int i = 0, int j = array.length - 1; i &lt; j; i++, j-- ){
          swap(start,end);
          start++;
          end--;
      }
      for(int i = 0; i &lt; 5; i++){ //print reversed array to user
          cout &lt;&lt; array[i];
      }
  
  }
  </code></pre>
  
  <p>I have little experience with pointers so I may be using them incorrectly. Any help would be appreciated!</p>