title: How do I get sentence reversal using pointers program to stop printing out jibberish?
body: <p>My code will compile and run, but the output is jibberish. It's literally just a bunch or random symbols and a few letters.</p>
  
  <p>This is my code:</p>
  
  <pre><code>int main()
  {
      char words[MAX];
      cout&lt;&lt;"This program will reverse your sentence.\n";
  
  
          cout&lt;&lt;"Please enter a sentence (up to 100 characters)\n";
          cin.getline(words,MAX);
          cout&lt;&lt;words&lt;&lt;"\n";
          sentence_reversal(words);
          cout&lt;&lt;endl;
  
      return 0;
  }
  
  void sentence_reversal(char a[])
  {
      char *the_front;
      char *rear;
      int i=0;
      rear = &amp;a[i];
      *rear=a[i];
      the_front=&amp;a[i];
      *the_front=a[i];
  
      for(int i = MAX-1; i&gt;=0; i--)
      {
          *rear=a[i];
          cout&lt;&lt;*rear;
  
      }
  delete the_front;
  delete rear;
  
  return;
  }
  </code></pre>
  
  <p>I have rewritten this code dozens of times and reviewed pointer just as much. I'm trying to understand how to use pointers with char arrays and cstrings. Originally I tried to have the pointers the_front and rear point to char a[] in the function, but I recieved the error:</p>
  
  <blockquote>
    <p>cannot convert char to *char.</p>
  </blockquote>
  
  <p>Now there is no error, but the reversed sentence isn't printing out, just jibberish.</p>