title: array of threads creation in c
body: <p>I have created two array of threads using POSIX thread.There are two thread functions student and teacher. My sample program is given below. I have a small problem which I have commented out in the code . I have written a thread join function at the last of main function. Is it okey or is there anything wrong in writing it in this way?</p>
  
  <p>Sample code fragment:</p>
  
  <pre><code>int main(void)
  {
      pthread_t thread[25];
      int i;
      int id1[25];   //for students
      int id2[6];   //for teachers
  
      for(i=0;i&lt;25;i++)
      {
            id1[i]=i;
            id2[i]=i;
            pthread_create(&amp;thread[i],NULL,student,(void*)&amp;id1[i] );
  
            if(i&lt;6)
            {
               pthread_create(&amp;thread[i],NULL,teacher,(void*)&amp;id2[i]);
            }
     }
  
  
  
    for (i=0;i&lt;25;i++)
    {
      pthread_join(thread[i],NULL);  //problem in this line
    }
  
   return 0;
  </code></pre>
  
  <p>}</p>