title: Error converting parameter in C++
body: <p>Header file</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;cstring&gt;
  
  const unsigned MaxLength = 11;
  
  class Phone {
  public:
  
      Phone(const char *phone) {
      setPhone(phone);
      }
  
      void        setPhone(const char Phone[ ]);
      const char* getPhone();
  
  private:
      char phone[MaxLength+1];
  };
  </code></pre>
  
  <p>Cpp file</p>
  
  <pre><code>#include "Phone.h"
  #include &lt;iostream&gt;
  #include &lt;ctype.h&gt;
  #include &lt;cstring&gt;
  #include &lt;cstdlib&gt; 
  
  using namespace std; 
  bool checkNum(const char* num);
  
  void Phone::setPhone(const char Phone[ ]) {
      strncpy(phone, Phone, MaxLength);
      phone[MaxLength] = '\0';
  }
  
  const char* Phone::getPhone() {
      return phone;
  }
  
  
  int main() {
      Phone i1("12345678901");
  
      cout &lt;&lt; i1.getPhone() &lt;&lt; endl;
      if (checkNum(i1.getPhone())) 
          cout &lt;&lt; "Correct" &lt;&lt; endl;
      else 
          cout &lt;&lt; "Invalid Wrong" &lt;&lt; endl;
  
  }
  
  bool checkNum(const char* num) {
      bool flag = true;
          if (atoi(num[0]) == 0)
              flag = false;
      return flag;
  }
  </code></pre>
  
  <p>When I tried to compile, I get this error:</p>
  
  <blockquote>
    <p>error C2664: 'atoi' : cannot convert
    parameter 1 from 'const char' to
    'const char *' 1>        Conversion
    from integral type to pointer type
    requires reinterpret_cast, C-style
    cast or function-style cast</p>
  </blockquote>
  
  <p>I am trying to read the first element of the array as an int so I can compare it using the atoi function. I am having a parameter mismatch but I can't find where it is. Any idea what's wrong?</p>