title: creating threads in C
body: <p>I am trying to run this C program using gcc -Wall -std=c99 hilo.c - ./a.out hilo.c and I am getting this error message: </p>
  
  <pre><code>hilo.c: In function ‘func’:
  hilo.c:6:3: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘pthread_t’ [-Wformat]
  hilo.c: In function ‘main’:
  hilo.c:14:3: warning: passing argument 3 of ‘pthread_create’ from incompatible pointer type [enabled by default]
  /usr/include/pthread.h:225:12: note: expected ‘void * (*)(void *)’ but argument is of type ‘void (*)(void)’
  hilo.c:15:3: warning: passing argument 3 of ‘pthread_create’ from incompatible pointer type [enabled by default]
  /usr/include/pthread.h:225:12: note: expected ‘void * (*)(void *)’ but argument is of type ‘void (*)(void)’
  hilo.c:24:3: warning: statement with no effect [-Wunused-value]
  /tmp/cchmI5wr.o: In function `main':
  hilo.c:(.text+0x52): undefined reference to `pthread_create'
  hilo.c:(.text+0x77): undefined reference to `pthread_create'
  hilo.c:(.text+0x97): undefined reference to `pthread_join'
  hilo.c:(.text+0xab): undefined reference to `pthread_join'
  collect2: ld returned 1 exit status
  </code></pre>
  
  <p>No idea what's wrong with the code so if anyone could help me would be it would be appreciated.</p>
  
  <p>This is the code:</p>
  
  <pre><code>#include &lt;pthread.h&gt;
  #include &lt;stdio.h&gt;
  
  void func(void){
  
           printf("thread %d\n", pthread_self());
           pthread_exit(0);
  
  }
  
     int main(void){
  
          pthread_t hilo1, hilo2;
  
          pthread_create(&amp;hilo1,NULL, func, NULL);
          pthread_create(&amp;hilo2,NULL, func, NULL);
  
          printf("the main thread continues with its execution\n");
  
          pthread_join(hilo1,NULL);
          pthread_join(hilo2, NULL);
  
          printf("the main thread finished");
  
          scanf;
  
    return(0);
  
  }
  </code></pre>