title: Converting to C style String
body: <p>I'm trying to create a function that takes in a string, the reverses it, which is all being done in main. Here's what I have so far. </p>
  
  <pre><code>#include &lt;cstring&gt;
  #include &lt;iostream&gt;
  #include &lt;string&gt;
  
  
  std::string str = "zombie";
  
  
  void Reverse( std::string a)
  {
  
      char* a1 = a.c_str;
      char* a2;
  
      for (int i = (strlen(a1) -1); a1[i]!=0; i--)
      {
          a2 += a1[i];
      }
  
      str = a2;
  }
  
  int main()
  {
      Reverse(str);
  
      std::cout &lt;&lt; str &lt;&lt; std::endl;
  }
  </code></pre>
  
  <p>But i keep getting this error. I can't utilize pointers in this question. Any suggestions?</p>
  
  <p>EDIT: I'm particularly having issues with converting the inserted parameter a into a c-style string. </p>
  
  <p>EDIT 2: So I started cleaning it up a bit, to my understanding, the code that I had wouldn't accomplish my goal at all, even with proper changes. Would this be on a better track? I plan on just converting the string to c-style before passing it to the function.</p>
  
  <pre><code>void Reverse(const char* s)
  {
      int x = strlen(s);
      std::string str = "";
  
      for (int c = x; c &gt; 0; c--)
      {
          str += s[c];
      }
  
  }
  </code></pre>