title: How to resolve a compile error in c++ code?
body: <pre><code>#include&lt;iostream&gt;
  #include&lt;stdlib.h&gt;
  
  using namespace std;
  
  class Solution {
  public:
    void reverseWords(string&amp; s)
    {
      cout &lt;&lt; s;
    }
  };
  
  int main()
  {
    string c;
    // c= (char *) malloc(100*sizeof(char ));
    c = "sahil solanki";
    Solution::reverseWords(&amp;c);
  }
  </code></pre>
  
  <p>When I compile this program it's giving me errors so how to remove errors. I am new to object oriented programming.</p>