why the atoi function is not working?
<p>The program stops working.
Even if I put only one int.
I tried many different ways but can't figure out what is wrong.
I am trying to take input of integers separated by space.
There can be any no of integers.</p>

<pre><code>#include&lt;stdio.h&gt;
#include&lt;stdlib.h&gt;

int main(void) {
    int i,j=0;
    int b[100];
    char a[100];
    fgets(a,100,stdin);
    for(i=0;i&lt;strlen(a);i++)
    {
        b[i] = atoi(a[j]);
        j=j+2;
    }
    for(i=0;i&lt;strlen(b);i++)
    {
        printf("%d ",b[i]);
    }
}
</code></pre>