title: running threads in background in c
body: <p>I have created 5 threads using pthread_create. I want to run these threads in background, so I didn't join these threads. But the program is producing weird output. What can be reason for these?</p>
  
  <p>Program:</p>
  
  <pre><code>for(i = 0; i &lt; 5; i++)
  {
  
  pthread_create(&amp;thread[i], NULL, func, &amp;i)
  
  }
  </code></pre>