title: Conversion of char array to integer using atoi caused segmentation fault
body: <p>I'm trying to convert a char array to an integer using <code>atoi</code>. But the code below produces a segmentation fault.</p>
  
  <p><strong>CODE:</strong></p>
  
  <pre><code>#include&lt;stdio.h&gt;
  #include&lt;stdlib.h&gt;
  #include&lt;string.h&gt;
  
  int main(){
      char a[10] = "1234567890";
      int x,i;
      for(i=0;i&lt;strlen(a);i++){
          x=atoi(a[i]);
          printf("%d",x);
      }
      return 0;
  }
  </code></pre>
  
  <p>What have I done wrong and is ther anything I can use instead of using <code>atoi</code>?</p>