title: Thread returning calculation
body: <p>I am trying to multiply matrices by using threads. I am not able to return a value from a thread to display in another function.</p>
  
  <p>Example code of the main and first thread below.</p>
  
  <pre><code>void MC0(int *);
  void Answer(int, int);
  int c0=0, c1=0;
  
  void MC0(int * c0){
      c0 = arrayCopy[1]*arrayCopy[9];     //arrayCopy is a copy of the input from the main "argv"
      pthread_exit(0);
  }
  
  void Answer(int c0, int c1){
      printf("c0: %d c1: %d", c0, c1);
  }
  
  int main(int argc, char *argv[]){
  
      pthread_create(&amp;myThread1, NULL, (void *) MC0, (void *) &amp;c0);
      sleep(1);
      pthread_create(&amp;myThread2, NULL, (void *) MC1, (void *) &amp;c1);
      sleep(1);
  
      pthread_join(myThread1, NULL);
      sleep(1);
      pthread_join(myThread2, NULL);
      sleep(1);
  
      Answer(c0, c1);
  
      exit(0);
  }
  </code></pre>
  
  <p>I probably have to do something with <code>pthread_mutex_lock</code> but I'm not sure how to do that. Pretty much I am trying to return <code>c0</code> from the <code>MC0</code> function to be able to display using <code>printf</code> in the <code>Answer(int, int)</code> function. </p>