hreads && ./threads</pre>

<pre>
#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;pthread.h&gt;

#define NTHREADS 5

void
*myFun(void *x)
{
	int tid;
	tid = *((int *) x);
	printf("Hi from thread %d!\n", tid);
	return NULL;
}

int
main(int argc, char *argv[])
{
	pthread_t threads[NTHREADS];
	int thread_args[NTHREADS];
	int rc, i;

	/* spawn the threads */
	for (i=0; i&lt;NTHREADS; ++i)
	{
		thread_args[i] = i;
		printf("spawning thread %d\n", i);
		rc = pthread_create(&threads[i], NULL, myFun,