boa noite pessoal, estou fazendo um programa em c,usando a bilbioteca pthreads, ele deve criar as threads,gerar um número aleatório,colocá-las para dormir e depois imprimir uma mensagem dizendo que acordou,é simples, mas ao rodar o programa diz Falha De Segmentação (core Dumped), o que está errado? Aqui está o codigo: #include <pthread.h> #include <math.h> #include <stdlib.h> #include <stdio.h> void *PrintThread(void *var) { int sleepTime,aux2; aux2 = (int)var; sleepTime = ( int ) (rand() %10 ); printf("\n Thread %d irá dormir por %d milisegundos",aux2,sleepTime); sleep( sleepTime ); printf("\n Thread %d done sleeping",aux2); pthread_exit(NULL); } int main() { pthread_t threads[2]; int i,erro,aux; void *status; for(i=0; i<3; i++) { printf("\n Criando Thread %d",i); erro = pthread_create(&(threads), NULL, PrintThread,(void *)i); if (erro) { printf ( "Erro numero %d\n", erro); exit (-1); } } for(i=0;i<3;i++) { aux = pthread_join(threads, &status);//sincronização entre as threads if (aux) { printf("ERRO; Retorno de pthread_join() foi %d\n", aux); exit(-1); } } pthread_exit(NULL); } Obrigada pessoal.