Passing char* to pthread crashing : <p>I am trying to get a time-based pooling system with threads. I managed to pull this off using fork(), now I am trying to implement it using threads. The timer thread seems to work fine, but for some reason I cannot pass a char* array to the thread (dumping core). </p>

<p>Note: If I try to exit the thread with status 0, I get no warning about giving an integer to a function returning void*. BUT, when I am trying to return something else, let it be 1, I get a warning. I tried to cast them to void*, but with no impact. </p>

<p>Now, for some code:</p>

<pre><code>#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;pthread.h&gt;
#include &lt;unistd.h&gt;
#define COUNTING_SUCCESS 0
#define POOLING_SUCCESS 1

int size = 3;

void *count(void *bound_arg){
    int index = 0;
    int *bound = (int*)bound_arg;
    printf("Counting started...\n");
    while(index &lt; *bound){
        printf("You have %d seconds left\n",*bound - index);
        sleep(1);
        index++;
    }

    printf("Time's up!\n");
    pthread_exit(COUNTING_SUCCESS);
}

void *pool(void *questions_ptr){
    char *questions = (char*)questions_ptr;
    char *answer = calloc(sizeof(char*)*size,size);
    for(int i =0 ; i &lt; size ; i++){
        printf("%s : ",questions[i]);
        scanf("%s",&amp;answer);
    }
    pthread_exit(0);

}

int main(){
    char* questions[] = {"Q1","Q2","Q3"};
    int limit = 3 ;
    int *countingLimit = &amp;limit;
    void *countingStatus;
    void *poolingStatus;


    pthread_t timerThread;
    int threadID = pthread_create(&amp;timerThread,NULL,count,(void*)countingLimit);
    pthread_join(timerThread,&amp;countingStatus);
    printf("%d\n",(int*)countingStatus);

    pthread_t poolingThread;
    int poolingThreadID = pthread_create(&amp;poolingThread,NULL,pool,(void*)questions);
    pthread_join(poolingThread,&amp;poolingStatus);
    printf("%d\n",(int*)poolingStatus);



}
</code></pre>

<p>Sample output:</p>

<pre><code>Counting started...
You have 3 seconds left
You have 2 seconds left
You have 1 seconds left
Time's up!
0
Segmentation fault (core dumped) //this is where i try to pass the char*
</code></pre>

<p>I cannot get it to enter the function.</p>

<p>P.S. I am building the executable using:</p>

<pre><code>gcc -o pool pool.c -pthread
</code></pre>
