title: C++ Reverse Array
body: <p>In C++, I need to:</p>
  
  <ul>
  <li>Read in a string from user input and place it into a char array [done]</li>
  <li>Then pass that array to a function [done]</li>
  <li>The function is supposed to reverse the order of characters [problem!]</li>
  <li>Then, back in the <code>main()</code>, it displays that original array with the newly reversed characters.</li>
  </ul>
  
  <p>I'm having trouble creating the function that actually does the reversing because I have some restrictions:</p>
  
  <ul>
  <li>I cannot have any local array
  variables.</li>
  <li>No pointers either</li>
  </ul>
  
  <p>My function is only passing in the original array ie:</p>
  
  <pre><code>void reverse(char word[])
  </code></pre>
  
  <p><strong>EDIT:</strong> Here's my code base so far:</p>
  
  <pre><code>void reverse(char word[]);
  
  void main() 
  {
    char word[MAX_SIZE];
  
    cout &lt;&lt; endl &lt;&lt; "Enter a word : ";
    cin &gt;&gt; word; 
    cout &lt;&lt; "You entered the word " &lt;&lt; word &lt;&lt; endl;
  
    reverse(word); 
  
    cout &lt;&lt; "The word in reverse order is " &lt;&lt; word &lt;&lt; endl;
  }
  
  void reverse(char myword[]) 
  {
    int i, temp;
    j--;
  
    for(i=0;i&lt;(j/2);i++) 
    {
      temp      = myword[i];
      myword[i] = myword[j];
      myword[j] = temp; 
  
      j--; 
    }
  }
  </code></pre>