title: How to write c++ code to reverse a string without using inbuilt function?
body: <p>I have write this code. It does not show any error but string is not reversed.please let me know where i have made the mistake?
  I'm using codeblock to write code and GCC compiler. I have created two functions reverseString and  printString, the printString function is working but reverseString is not working. what can i do?</p>
  <pre><code>#include &lt;iostream&gt;
  #include&lt;string&gt;
  using namespace std;
  
  void reverseString(string s, int iNode, int lNode){
      while(iNode &lt; lNode){
          char temp = s[iNode];
          s[iNode] = s[lNode];
          s[lNode] = temp;
          iNode++;
          lNode--;
      }
  }
  
  void printString(string s, int n){
  
      for(int i=0; i&lt;n; i++){
          cout &lt;&lt; s[i];
          cout &lt;&lt; endl;
      }
  }
  
  int main() {
    string s;
    cout &lt;&lt; &quot;Type String To Reverse: \n&quot;;
    cin &gt;&gt; s;
    cout &lt;&lt; &quot;String In Actual Order: \n&quot;;
    printString(s,s.length());
    reverseString(s, 0, s.length()-1);
    cout &lt;&lt; &quot;String In Reverse Order: \n&quot;;
    printString(s,s.length());
  
    return 0;
  }
  </code></pre>