c atoi() function not working
<p>Here is my code. The statement, int value=atoi(ptr[index]) in findMin() function ,gives an error as shown in screenshot. </p>

<p><a href="https://i.stack.imgur.com/drRaB.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/drRaB.png" alt="enter image description here"></a></p>

<p>The strange thing is that when I use the same atoi() function in main, everything works pretty fine but it screams in findMin!</p>

<pre><code>CODE:
void* findMin(void *param); 

int main(int argc, char *argv[])
{

    pthread_t t2; //for min
    num=argc;

    /*int index=1; THIS WORKS 
    int value=atoi(argv[index]);*/

    //creating worker thread
    pthread_create(&amp;t1,NULL,findMin,argv);

    pthread_join(t2,NULL); //wait for min
    printf("The minimum value is %d\n",min);


    return 0;
}

void* findMin(void *param) 
{
    char *ptr=(char *) param; //casting 
    int index=1;
    min=ptr[1];
    for(index; index&lt;num; index++)
    {
         int value=atoi(ptr[index]); //THIS SCREAMS LIKE HELL!
         if(comp&lt;min) min=value;

    }
}
</code></pre>