title: pthread and mutex_lock throwing segmentation core dumped
body: <p>I am trying to play with <strong>threads</strong> using a <strong>mutex</strong> for syncronization, but it seems that my code throws a &quot;<strong>segmentation fault core dumped</strong>&quot; error every time after compiling it.</p>
  <pre><code>#include &lt;pthread.h&gt;
  #include &lt;stdio.h&gt;
  
  pthread_mutex_t mutex;
  int *s = 0;
  void *fonction(void * arg0) {
      pthread_mutex_lock( &amp; mutex);
      *s += *((int *)arg0) * 1000000;
      pthread_mutex_unlock(&amp;mutex);
  
  }
  int main() {
      pthread_t thread[5];
      int ordre[5];
      for (int i = 0; i &lt; 5; i++)
          ordre[i] = i;
      for (int i = 0; i &lt; 5; i++)
          pthread_create(&amp;thread[i], NULL, fonction, &amp; ordre[i]);
      for (int i = 0; i &lt; 5; i++)
          pthread_join(thread[i], NULL);
  
      printf(&quot;%d\n&quot;, * s);
  
      return 0;
  
  }
  </code></pre>