title: How to fix "used struct type value where scalar is required"?
body: <p>I keep getting this error when I compile and I cannot figure out why. The code block is: </p>
  
  <pre><code>static int
  run(int nm, int nf)
  {
      int i, j;
      int err, n = nm + nf;
      pthread_t thread[n];
  
      for (i = 0; i &lt; n; i++) {
          err = pthread_create(&amp;thread[i], NULL,
                    i &lt; nm ? male : female, &amp;shared_bathroom);
          if (err) {
              fprintf(stderr, "%s: %s: unable to create thread %d: %d\n",
                      progname, __func__, i, err);
              return EXIT_FAILURE;
          }
      }
  
      for (j = 0; j &lt; n; j++) {
          if (thread[j]) (void) pthread_join(thread[j], NULL);
      }
  
      return EXIT_SUCCESS;
  }
  </code></pre>
  
  <p>The error comes up for the line with the if statement under the second for loop. Specifically, I think it is referring to <code>(thread[j])</code>. </p>