title: C++ Atoi function gives error
body: <p>I have a string which has 5 characters. I want to convert each single character to int and then multiply them with each other. This is the code : </p>
  
  <pre><code>int main()
  {
      int x;
      string str = "12345";
      int a[5];
      for(int i = 0; i &lt; 5; i++)
      {
          a[i] = atoi(str[i]);
      }
      x = a[0]*a[1]*a[2]*a[3]*a[4];
      cout&lt;&lt;x&lt;&lt;endl;
  }
  </code></pre>
  
  <p>It gives this error for the line with atoi : </p>
  
  <blockquote>
    <p>invalid conversion from 'char' to 'const char*' [-fpermissive]|</p>
  </blockquote>
  
  <p>How can I fix this? Thanks.</p>