title: Cannot Convert string to 'char*' for argument error?
body: <p>I do not understand what this error is saying in my C++ code</p>
  
  <blockquote>
    <p>error: cannot convert 'std::string {aka std::basic_string}' to
    'char' for argument '1' to 'bool areParenthesesBalanced(char*)'</p>
    
    <p>if(areParenthesesBalanced(str))</p>
  </blockquote>
  
  <p>My Code:</p>
  
  <pre><code>bool areParenthesesBalanced(char expr[])
  {
      stack&lt;char&gt; s;
      char a, b, c;
  
      for (int i=0; i&lt;strlen(expr); i++)
      {
          if (expr[i]=='(' || expr[i]=='[' || expr[i]=='{')
          {
              s.push (expr[i]);
          }
          else
          {
              switch (expr[i])
              {
                  case ')':
                  a = s.top();
                  s.pop();
                  if (a=='{' || a=='[')
                  cout&lt;&lt;"Not Balanced";
                  break;
  
                  case '}':
                  b = s.top();
                  s.pop();
                  if (b=='(' || b=='[')
                  cout&lt;&lt;"Not Balanced";
                  break;
  
                  case ']':
                  c = s.top();
                  s.pop();
                  if (c=='(' || c=='{')
                  cout&lt;&lt;"Not Balanced";
                  break;
              }
          }
      }
  
      if (s.empty())  //check if stack is empty
      {
          return true;
      }
      else
      {
          return false;
      }
  }
  
  int main()
  {
      std::ifstream t("file.txt");
      std::string str;
      t.seekg(0, std::ios::end);
      str.reserve(t.tellg());
      t.seekg(0, std::ios::beg);
      str.assign((std::istreambuf_iterator&lt;char&gt;(t)), std::istreambuf_iterator&lt;char&gt;());
  
      if(areParenthesesBalanced(str))
      {
          cout&lt;&lt;"Balanced";
      }
      else
      {
          cout&lt;&lt;"Not Balanced";
      }
      return 0;
  }
  </code></pre>
  
  <p>I do not understand what it is seeing as the issue! Any ideas?</p>